diff --git a/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdExcludesMojo.java b/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdExcludesMojo.java index 5f5836e2..a9780772 100644 --- a/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdExcludesMojo.java +++ b/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdExcludesMojo.java @@ -1061,7 +1061,8 @@ static Map> collectIntegrationTests(final MavenSourceTree tree, Pred final String pomXmlRelPath = PomTunerUtils.toUnixPath(basedir.relativize(pomXmlPath).toString()); final Module testModule = tree.getModulesByPath().get(pomXmlRelPath); if (testModule == null) { - throw new IllegalStateException("Could not find module for path " + pomXmlRelPath); + log.warn("Could not find module for path " + pomXmlRelPath); + continue; } final Ga moduleGa = evaluator.evaluateGa(testModule.getGav()); if (!excludeTests.contains(moduleGa)) { diff --git a/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdInitMojo.java b/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdInitMojo.java index 7326f979..c79cdfe4 100644 --- a/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdInitMojo.java +++ b/prod-maven-plugin/src/main/java/org/l2x6/cq/maven/prod/ProdInitMojo.java @@ -52,6 +52,7 @@ import org.l2x6.pom.tuner.PomTransformer.TransformationContext; import org.l2x6.pom.tuner.PomTunerUtils; import org.l2x6.pom.tuner.model.Dependency; +import org.l2x6.pom.tuner.model.Ga; import org.l2x6.pom.tuner.model.Gavtcs; import org.l2x6.pom.tuner.model.Profile; import org.w3c.dom.Document; @@ -153,6 +154,14 @@ public class ProdInitMojo extends AbstractMojo { @Parameter(defaultValue = "${quarkiverse-cxf.version}", readonly = true) String quarkiverseCxfVersion; + /** + * Camel Sap version + * + * @since 4.4.6 + */ + @Parameter(defaultValue = "${camel-sap.version}", required = true) + String camelSapVersion; + /** {@inheritDoc} */ @Override public void execute() throws MojoExecutionException, MojoFailureException { @@ -195,6 +204,10 @@ public void execute() throws MojoExecutionException, MojoFailureException { props.addChildTextElementIfNeeded("camel-quarkus-community.version", version, Comparator.comparing(Map.Entry::getKey, Comparators.before("cassandra-quarkus.version"))); + getLog().info("Adding to pom.xml: camel-sap.version property"); + props.addChildTextElementIfNeeded("camel-sap.version", camelSapVersion, + Comparator.comparing(Map.Entry::getKey, Comparators.before("cassandra-quarkus.version"))); + getLog().info("Adding to pom.xml: quarkus-community.version property"); props.addChildTextElementIfNeeded("quarkus-community.version", quarkusVersion, Comparator.comparing(Map.Entry::getKey, Comparators.after("quarkus.version"))); @@ -231,10 +244,18 @@ public void execute() throws MojoExecutionException, MojoFailureException { final String xPath = PomTunerUtils.anyNs("project", "modules", "module") + "[text() = 'docs']"; context.removeNode(xPath, true, true, false); - /* Add product module */ - getLog().info("Adding to pom.xml: product module"); final ContainerElement profileParent = context.getOrAddProfileParent(null); final ContainerElement modules = profileParent.getOrAddChildContainerElement("modules"); + + /* Add integration-tests/message module. + camel-quarkus-integration-test-messaging-jms needed to be productized as a transitive dependency + of jms-(artemis|qpid-jms|ibmmq)-client tests. + */ + getLog().info("Adding to pom.xml: integration-tests/messaging module"); + modules.addChildTextElement("module", "integration-tests/messaging"); + + /* Add product module */ + getLog().info("Adding to pom.xml: product module"); modules.addChildTextElement("module", "product"); /* Change the version of camel-build-tools under license-maven-plugin to camel-community.version */ @@ -327,6 +348,14 @@ public void execute() throws MojoExecutionException, MojoFailureException { .map(ContainerElement::asGavtcs) .filter(gavtcs -> gavtcs.getGroupId().equals("org.graalvm.js")) .forEach(node -> node.getNode().setVersion("${graalvm-community.version}")); + + /** Add camel-sap and camel-quarkus-sap dependencies */ + dependencyManagementDeps.addGavtcs(new Gavtcs("org.fusesource", "camel-sap", "${camel-sap.version}", + "", "", "", Ga.of("org.eclipse:osgi"))); + dependencyManagementDeps + .addGavtcs(new Gavtcs("org.apache.camel.quarkus", "camel-quarkus-sap", "${camel-quarkus.version}")); + dependencyManagementDeps.addGavtcs( + new Gavtcs("org.apache.camel.quarkus", "camel-quarkus-sap-deployment", "${camel-quarkus.version}")); }); /* Edit poms/bom-test/pom.xml */ @@ -350,6 +379,25 @@ public void execute() throws MojoExecutionException, MojoFailureException { qcxfBomNode.getNode().setVersion("${quarkiverse-cxf-community.version}"); }); + /* Edit extensions-jvm/pom.xml to add sap extension */ + new PomTransformer(basedir.toPath().resolve("extensions-jvm/pom.xml"), charset, simpleElementWhitespace).transform( + (Document document, TransformationContext context) -> { + final ContainerElement profileParent = context.getOrAddProfileParent(null); + final ContainerElement modules = profileParent.getOrAddChildContainerElement("modules"); + + modules.addChildTextElement("module", "sap"); + }); + + /* Edit integration-tests-jvm/pom.xml to add sap test */ + new PomTransformer(basedir.toPath().resolve("integration-tests-jvm/pom.xml"), charset, simpleElementWhitespace) + .transform( + (Document document, TransformationContext context) -> { + final ContainerElement profileParent = context.getOrAddProfileParent(null); + final ContainerElement modules = profileParent.getOrAddChildContainerElement("modules"); + + modules.addChildTextElement("module", "sap"); + }); + // Force Camel community version for unsupported Maven plugins final Path buildParentItPomPath = basedir.toPath().resolve("poms/build-parent-it/pom.xml"); new PomTransformer(buildParentItPomPath, charset, simpleElementWhitespace) @@ -374,7 +422,9 @@ public void execute() throws MojoExecutionException, MojoFailureException { "product/pom.xml", "product/README.adoc", "product/src/main/groovy/generate-camel-quarkus-product-json.groovy", - "product/src/main/resources/camel-quarkus-product-source.json"); + "product/src/main/resources/camel-quarkus-product-source.json", + "extensions-jvm/sap/", + "integration-tests-jvm/sap/"); try (Repository repo = new FileRepositoryBuilder() .readEnvironment() // scan environment GIT_* variables @@ -389,20 +439,26 @@ public void execute() throws MojoExecutionException, MojoFailureException { final RevTree tree = commit.getTree(); for (String relPath : filesToCopy) { - getLog().info("Copying from " + fromBranch + ": " + relPath); try (TreeWalk treeWalk = new TreeWalk(repo)) { treeWalk.addTree(tree); treeWalk.setRecursive(true); treeWalk.setFilter(PathFilter.create(relPath)); - if (!treeWalk.next()) { - throw new IllegalStateException("Could not find '" + relPath + "' in branch " + fromBranch); + boolean found = false; + while (treeWalk.next()) { + final ObjectId objectId = treeWalk.getObjectId(0); + + final String copyPath = treeWalk.getPathString(); + final Path destFile = basedir.toPath().resolve(copyPath); + + getLog().info("Copying from " + fromBranch + ": " + copyPath); + Files.createDirectories(destFile.getParent()); + try (OutputStream out = Files.newOutputStream(destFile)) { + repo.open(objectId).copyTo(out); + } + found = true; } - final ObjectId objectId = treeWalk.getObjectId(0); - - final Path destFile = basedir.toPath().resolve(relPath); - Files.createDirectories(destFile.getParent()); - try (OutputStream out = Files.newOutputStream(destFile)) { - repo.open(objectId).copyTo(out); + if (!found) { + throw new IllegalStateException("Could not find '" + relPath + "' in branch " + fromBranch); } } }