Skip to content

Commit

Permalink
CAMEL-21606 - Camel route validation mojo fails if it depends on exte…
Browse files Browse the repository at this point in the history
…rnal sources without cleaning the target folder (#16763)
  • Loading branch information
ammachado authored and davsclaus committed Jan 10, 2025
1 parent 41292bb commit a2eff0e
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,10 @@ private void unzipIntoCache(List<MavenArtifact> mavenSourcesArtifacts, Path extr

Path target = extraSourcesPath.resolve(artifact.getGav().getArtifactId());
getLog().info("Unzipping the artifact: " + artifact + " to " + target);
if (Files.exists(target)) {
continue;
if (!Files.exists(target)) {
unzipArtifact(artifact, target);
}

unzipArtifact(artifact, target);

FileUtil.findJavaFiles(target.toFile(), javaFiles);
FileUtil.findXmlFiles(target.toFile(), xmlFiles);
}
Expand Down Expand Up @@ -555,7 +553,7 @@ protected void doExecuteRoutes(CamelCatalog catalog) throws MojoExecutionExcepti

// find all java route builder classes
findJavaRouteBuilderClasses(javaFiles, includeJava, includeTest, project);
// find all xml routes
// find all XML routes
findXmlRouters(xmlFiles, includeXml, includeTest, project);

for (File file : javaFiles) {
Expand Down Expand Up @@ -847,7 +845,7 @@ private void parseJavaRouteFile(
String fqn = file.getPath();
String baseDir = ".";
JavaType<?> out = Roaster.parse(file);
// we should only parse java classes (not interfaces and enums etc)
// we should only parse java classes (not interfaces and enums etc.)
if (out instanceof JavaClassSource clazz) {
RouteBuilderParser.parseRouteBuilderEndpoints(clazz, baseDir, fqn, fileEndpoints, unparsable, includeTest);
RouteBuilderParser.parseRouteBuilderSimpleExpressions(clazz, baseDir, fqn, fileSimpleExpressions);
Expand Down Expand Up @@ -899,7 +897,7 @@ private int validateEndpointPairs(List<CamelEndpointDetails> endpoints, String s
Set<CamelEndpointDetails> producers = endpoints.stream()
.filter(e -> e.isProducerOnly() && e.getEndpointUri().startsWith(scheme + ":")).collect(Collectors.toSet());

// are there any producers that do not have a consumer pair
// are there any producers that do not have a consumer pair?
for (CamelEndpointDetails detail : producers) {
boolean none = consumers.stream().noneMatch(c -> matchEndpointPath(detail.getEndpointUri(), c.getEndpointUri()));
if (none) {
Expand Down

0 comments on commit a2eff0e

Please sign in to comment.