This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 4ed3259c6cf chore(CLI): Refactor Dependency Runtime command (#18308) 4ed3259c6cf is described below commit 4ed3259c6cfc5bbca0da1595ad7e948129671cb8 Author: Ricardo M. <lord...@gmail.com> AuthorDate: Thu Jun 12 10:35:08 2025 -0400 chore(CLI): Refactor Dependency Runtime command (#18308) Currently, the `dependency runtime` command operates in the `cwd`. This commit updates the mechanism to receive a given `pom.xml`, easing its use for tooling. --- .../dsl/jbang/core/commands/DependencyRuntime.java | 237 ++++++++++----------- .../camel/dsl/jbang/core/common/CatalogLoader.java | 3 +- .../dsl/jbang/core/common/RuntimeInformation.java | 81 +++++++ .../jbang/core/commands/DependencyRuntimeTest.java | 124 +++++++++++ .../test/resources/pom-xml-files/quarkus-pom.xml | 78 +++++++ .../resources/pom-xml-files/springboot-pom.xml | 162 ++++++++++++++ 6 files changed, 561 insertions(+), 124 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntime.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntime.java index 8e2ff4bcb61..d26a89171d2 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntime.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntime.java @@ -18,9 +18,6 @@ package org.apache.camel.dsl.jbang.core.commands; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.LinkedHashMap; -import java.util.Map; import java.util.StringJoiner; import javax.xml.parsers.DocumentBuilder; @@ -30,19 +27,22 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.catalog.CamelCatalog; import org.apache.camel.dsl.jbang.core.common.CatalogLoader; +import org.apache.camel.dsl.jbang.core.common.RuntimeInformation; +import org.apache.camel.dsl.jbang.core.common.RuntimeType; import org.apache.camel.dsl.jbang.core.common.XmlHelper; -import org.apache.camel.util.json.Jsoner; import picocli.CommandLine; -@CommandLine.Command(name = "runtime", - description = "Display Camel runtime and version for given Maven project", sortOptions = false, - showDefaultValues = true) +@CommandLine.Command(name = "runtime", description = "Display Camel runtime and version for given Maven project", + sortOptions = false, showDefaultValues = true) public class DependencyRuntime extends CamelCommand { - @CommandLine.Option(names = { "--json" }, - description = "Output in JSON Format") + @CommandLine.Parameters(description = "The pom.xml to analyze.", arity = "1", paramLabel = "<pom.xml>") + public Path pomXml; + @CommandLine.Option(names = { "--json" }, description = "Output in JSON Format") boolean jsonOutput; public DependencyRuntime(CamelJBangMain main) { @@ -52,134 +52,125 @@ public class DependencyRuntime extends CamelCommand { @Override public Integer doCall() throws Exception { // read pom.xml - Path pom = Paths.get(".").resolve("pom.xml"); - if (Files.exists(pom)) { - DocumentBuilderFactory dbf = XmlHelper.createDocumentBuilderFactory(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document dom = db.parse(Files.newInputStream(pom)); - NodeList nl = dom.getElementsByTagName("dependency"); - String camelVersion = null; - String camelQuarkusVersion = null; - String springBootVersion = null; - String quarkusVersion = null; - String quarkusGroupId = "io.quarkus.platform"; - for (int i = 0; i < nl.getLength(); i++) { - Element node = (Element) nl.item(i); - - // must be child at <project/dependencyManagement> or <project/dependencies> - String p = node.getParentNode().getNodeName(); - String p2 = node.getParentNode().getParentNode().getNodeName(); - boolean accept = ("dependencyManagement".equals(p2) || "project".equals(p2)) && (p.equals("dependencies")); - if (!accept) { - continue; - } + if (!Files.exists(pomXml)) { + printer().println(String.format("Cannot find %s", pomXml)); + return 1; + } - String g = node.getElementsByTagName("groupId").item(0).getTextContent(); - String a = node.getElementsByTagName("artifactId").item(0).getTextContent(); - String v = null; - NodeList vl = node.getElementsByTagName("version"); - if (vl.getLength() > 0) { - v = vl.item(0).getTextContent(); - } + DocumentBuilderFactory dbf = XmlHelper.createDocumentBuilderFactory(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document dom = db.parse(Files.newInputStream(pomXml)); + NodeList nl = dom.getElementsByTagName("dependency"); - // BOMs - if ("org.apache.camel".equals(g) && "camel-bom".equals(a)) { - camelVersion = v; - continue; - } - if ("org.apache.camel.springboot".equals(g) && "camel-spring-boot-bom".equals(a)) { - camelVersion = v; - continue; - } - if ("org.springframework.boot".equals(g) && "spring-boot-dependencies".equals(a)) { - springBootVersion = v; - continue; - } - if (("${quarkus.platform.group-id}".equals(g) || "io.quarkus.platform".equals(g)) && - ("${quarkus.platform.artifact-id}".equals(a) || "quarkus-bom".equals(a))) { - if ("${quarkus.platform.version}".equals(v)) { - quarkusVersion = dom.getElementsByTagName("quarkus.platform.version").item(0).getTextContent(); - } else { - quarkusVersion = v; - } - continue; - } - if (("${quarkus.platform.group-id}".equals(g))) { - quarkusGroupId = dom.getElementsByTagName("quarkus.platform.group-id").item(0).getTextContent(); - } + RuntimeInformation runtimeInformation = new RuntimeInformation(); + + for (int i = 0; i < nl.getLength(); i++) { + Element node = (Element) nl.item(i); + + // must be child at <project/dependencyManagement> or <project/dependencies> + String p = node.getParentNode().getNodeName(); + String p2 = node.getParentNode().getParentNode().getNodeName(); + boolean accept = ("dependencyManagement".equals(p2) || "project".equals(p2)) && (p.equals("dependencies")); + if (!accept) { + continue; } - String repos = null; - StringJoiner sj = new StringJoiner(","); - nl = dom.getElementsByTagName("repository"); - for (int i = 0; i < nl.getLength(); i++) { - Element node = (Element) nl.item(i); - - // must be child at <repositories/repository> - String p = node.getParentNode().getNodeName(); - boolean accept = "repositories".equals(p); - if (!accept) { - continue; - } - String url = node.getElementsByTagName("url").item(0).getTextContent(); - sj.add(url); + String g = node.getElementsByTagName("groupId").item(0).getTextContent(); + String a = node.getElementsByTagName("artifactId").item(0).getTextContent(); + String v = null; + NodeList vl = node.getElementsByTagName("version"); + if (vl.getLength() > 0) { + v = vl.item(0).getTextContent(); + } + + // BOMs + if ("org.apache.camel".equals(g) && "camel-bom".equals(a)) { + runtimeInformation.setCamelVersion(v); + continue; } - if (sj.length() > 0) { - repos = sj.toString(); + if ("org.apache.camel.springboot".equals(g) && "camel-spring-boot-bom".equals(a)) { + runtimeInformation.setCamelVersion(v); + continue; } + if ("org.springframework.boot".equals(g) && "spring-boot-dependencies".equals(a)) { + runtimeInformation.setSpringBootVersion(v); + continue; + } + if (("${quarkus.platform.group-id}".equals(g) || "io.quarkus.platform".equals(g)) && + ("${quarkus.platform.artifact-id}".equals(a) || "quarkus-bom".equals(a))) { + if ("${quarkus.platform.version}".equals(v)) { + runtimeInformation.setQuarkusVersion( + dom.getElementsByTagName("quarkus.platform.version").item(0).getTextContent()); + } else { + runtimeInformation.setQuarkusVersion(v); + } + continue; + } + if (("${quarkus.platform.group-id}".equals(g))) { + runtimeInformation.setQuarkusGroupId( + dom.getElementsByTagName("quarkus.platform.group-id").item(0).getTextContent()); + } + } - // its a bit harder to know the camel version from Quarkus because of the universal BOM - if (quarkusVersion != null && camelVersion == null) { - CamelCatalog catalog = CatalogLoader.loadQuarkusCatalog(repos, quarkusVersion, quarkusGroupId); - if (catalog != null) { - // find out the camel quarkus version via the constant language that are built-in camel-core - camelQuarkusVersion = catalog.languageModel("constant").getVersion(); - // okay so the camel version is also hard to resolve from quarkus - camelVersion = CatalogLoader.resolveCamelVersionFromQuarkus(repos, camelQuarkusVersion); - } + String repos = null; + StringJoiner sj = new StringJoiner(","); + nl = dom.getElementsByTagName("repository"); + for (int i = 0; i < nl.getLength(); i++) { + Element node = (Element) nl.item(i); + + // must be child at <repositories/repository> + String p = node.getParentNode().getNodeName(); + boolean accept = "repositories".equals(p); + if (!accept) { + continue; } + String url = node.getElementsByTagName("url").item(0).getTextContent(); + sj.add(url); + } + if (sj.length() > 0) { + repos = sj.toString(); + } - String runtime = "camel-main"; - if (springBootVersion != null) { - runtime = "camel-spring-boot"; - } else if (quarkusVersion != null) { - runtime = "camel-quarkus"; + // it's a bit harder to know the camel version from Quarkus because of the universal BOM + if (runtimeInformation.getQuarkusVersion() != null && runtimeInformation.getCamelVersion() == null) { + CamelCatalog catalog = CatalogLoader.loadQuarkusCatalog(repos, runtimeInformation.getQuarkusVersion(), + runtimeInformation.getQuarkusGroupId()); + if (catalog != null) { + // find out the camel quarkus version via the constant language that are built-in camel-core + runtimeInformation.setCamelQuarkusVersion(catalog.languageModel("constant").getVersion()); + // okay so the camel version is also hard to resolve from quarkus + runtimeInformation.setCamelVersion(CatalogLoader.resolveCamelVersionFromQuarkus(repos, + runtimeInformation.getCamelQuarkusVersion())); } + } - if (jsonOutput) { - Map<String, String> map = new LinkedHashMap<>(); - map.put("runtime", runtime); - if (camelVersion != null) { - map.put("camelVersion", camelVersion); - } - if (camelQuarkusVersion != null) { - map.put("camelQuarkusVersion", camelQuarkusVersion); - } - if (springBootVersion != null) { - map.put("springBootVersion", springBootVersion); - } - if (quarkusVersion != null) { - map.put("quarkusVersion", quarkusVersion); - } - printer().println( - Jsoner.serialize(map)); - } else { - printer().println("Runtime: " + runtime); - if (camelVersion != null) { - printer().println("Camel Version: " + camelVersion); - } - if (camelQuarkusVersion != null) { - printer().println("Camel Quarkus Version: " + camelQuarkusVersion); - } - if (springBootVersion != null) { - printer().println("Spring Boot Version: " + springBootVersion); - } else if (quarkusVersion != null) { - printer().println("Quarkus Version: " + quarkusVersion); - } + runtimeInformation.setType(RuntimeType.main); + if (runtimeInformation.getSpringBootVersion() != null) { + runtimeInformation.setType(RuntimeType.springBoot); + } else if (runtimeInformation.getQuarkusVersion() != null) { + runtimeInformation.setType(RuntimeType.quarkus); + } + + if (jsonOutput) { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + String json = mapper.writeValueAsString(runtimeInformation); + printer().println(json); + } else { + printer().println("Runtime: " + runtimeInformation.getType()); + if (runtimeInformation.getCamelVersion() != null) { + printer().println("Camel Version: " + runtimeInformation.getCamelVersion()); + } + if (runtimeInformation.getCamelQuarkusVersion() != null) { + printer().println("Camel Quarkus Version: " + runtimeInformation.getCamelQuarkusVersion()); + } + if (runtimeInformation.getSpringBootVersion() != null) { + printer().println("Spring Boot Version: " + runtimeInformation.getSpringBootVersion()); + } else if (runtimeInformation.getQuarkusVersion() != null) { + printer().println("Quarkus Version: " + runtimeInformation.getQuarkusVersion()); } } return 0; } - } diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CatalogLoader.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CatalogLoader.java index bca0712fcb9..fc5fa5d1ac7 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CatalogLoader.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CatalogLoader.java @@ -40,6 +40,7 @@ import org.apache.camel.tooling.maven.MavenArtifact; public final class CatalogLoader { + public static final String QUARKUS_GROUP_ID = "io.quarkus.platform"; private static final String DEFAULT_CAMEL_CATALOG = "org.apache.camel.catalog.DefaultCamelCatalog"; private static final String SPRING_BOOT_CATALOG_PROVIDER = "org.apache.camel.springboot.catalog.SpringBootRuntimeProvider"; @@ -168,7 +169,7 @@ public final class CatalogLoader { // shrinkwrap does not return POM file as result (they are hardcoded to be filtered out) // so after this we download a JAR and then use its File location to compute the file for the downloaded POM if (quarkusGroupId == null) { - quarkusGroupId = "io.quarkus.platform"; + quarkusGroupId = QUARKUS_GROUP_ID; } MavenArtifact ma = downloader.downloadArtifact(quarkusGroupId, "quarkus-camel-bom:pom", quarkusVersion); if (ma != null && ma.getFile() != null) { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeInformation.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeInformation.java new file mode 100644 index 00000000000..078dc5bb57d --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeInformation.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dsl.jbang.core.common; + +import static org.apache.camel.dsl.jbang.core.common.CatalogLoader.QUARKUS_GROUP_ID; + +public class RuntimeInformation { + private RuntimeType type; + private String camelVersion; + private String camelQuarkusVersion; + private String springBootVersion; + + private String quarkusVersion; + private String quarkusGroupId; + + public RuntimeInformation() { + this.quarkusGroupId = QUARKUS_GROUP_ID; + } + + public RuntimeType getType() { + return type; + } + + public void setType(RuntimeType type) { + this.type = type; + } + + public String getCamelVersion() { + return camelVersion; + } + + public void setCamelVersion(String camelVersion) { + this.camelVersion = camelVersion; + } + + public String getCamelQuarkusVersion() { + return camelQuarkusVersion; + } + + public void setCamelQuarkusVersion(String camelQuarkusVersion) { + this.camelQuarkusVersion = camelQuarkusVersion; + } + + public String getSpringBootVersion() { + return springBootVersion; + } + + public void setSpringBootVersion(String springBootVersion) { + this.springBootVersion = springBootVersion; + } + + public String getQuarkusVersion() { + return quarkusVersion; + } + + public void setQuarkusVersion(String quarkusVersion) { + this.quarkusVersion = quarkusVersion; + } + + public String getQuarkusGroupId() { + return quarkusGroupId; + } + + public void setQuarkusGroupId(String quarkusGroupId) { + this.quarkusGroupId = quarkusGroupId; + } +} diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntimeTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntimeTest.java new file mode 100644 index 00000000000..515aa4d2f43 --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyRuntimeTest.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dsl.jbang.core.commands; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class DependencyRuntimeTest extends CamelCommandBaseTest { + + @TempDir + File tempDir; + + DependencyRuntime command; + Path pomFilePath; + + private static Stream<Arguments> testOutputArguments() { + return Stream.of(Arguments.of(TestArguments.QUARKUS_POM, TestArguments.QUARKUS_POM_OUTPUT), + Arguments.of(TestArguments.SPRING_BOOT_POM, TestArguments.SPRING_BOOT_POM_OUTPUT)); + } + + private static Stream<Arguments> testJsonOutputArguments() { + return Stream.of(Arguments.of(TestArguments.QUARKUS_POM, TestArguments.QUARKUS_POM_JSON_OUTPUT), + Arguments.of(TestArguments.SPRING_BOOT_POM, TestArguments.SPRING_BOOT_POM_JSON_OUTPUT)); + } + + @BeforeEach + void setUp() { + command = new DependencyRuntime(new CamelJBangMain().withPrinter(printer)); + + pomFilePath = tempDir.toPath().resolve("pom.xml"); + command.pomXml = pomFilePath; + } + + @AfterEach + void tearDown() throws Exception { + Files.deleteIfExists(pomFilePath); + } + + @Test + void testNoPomFile() throws Exception { + command.pomXml = tempDir.toPath().resolve("non-existing/pom.xml"); + int exit = command.doCall(); + + assertEquals(1, exit); + } + + @ParameterizedTest + @MethodSource("testOutputArguments") + void testStringOutput(String testPomXmlFile, String output) throws Exception { + try (var in = getClass().getClassLoader().getResourceAsStream(testPomXmlFile)) { + if (in == null) { + throw new IllegalStateException(String.format("Resource not found: %s", testPomXmlFile)); + } + Files.copy(in, pomFilePath); + } + + int exit = command.doCall(); + assertEquals(0, exit); + assertEquals(output, printer.getOutput()); + } + + @ParameterizedTest + @MethodSource("testJsonOutputArguments") + void testJsonOutput(String testPomXmlFile, String jsonOutput) throws Exception { + try (var in = getClass().getClassLoader().getResourceAsStream(testPomXmlFile)) { + if (in == null) { + throw new IllegalStateException(String.format("Resource not found: %s", testPomXmlFile)); + } + Files.copy(in, pomFilePath); + } + + command.jsonOutput = true; + int exit = command.doCall(); + + assertEquals(0, exit); + assertEquals(jsonOutput, printer.getOutput()); + } + + private static class TestArguments { + static final String QUARKUS_POM = "pom-xml-files/quarkus-pom.xml"; + static final String QUARKUS_POM_OUTPUT = """ + Runtime: quarkus + Camel Version: 4.11.0 + Camel Quarkus Version: 3.23.0 + Quarkus Version: 3.23.0"""; + static final String QUARKUS_POM_JSON_OUTPUT + = "{\"type\":\"quarkus\",\"camelVersion\":\"4.11.0\",\"camelQuarkusVersion\":\"3.23.0\",\"quarkusVersion\":\"3.23.0\",\"quarkusGroupId\":\"io.quarkus.platform\"}"; + + static final String SPRING_BOOT_POM = "pom-xml-files/springboot-pom.xml"; + static final String SPRING_BOOT_POM_OUTPUT = """ + Runtime: springBoot + Camel Version: 4.12.0 + Spring Boot Version: 3.4.5"""; + static final String SPRING_BOOT_POM_JSON_OUTPUT + = "{\"type\":\"springBoot\",\"camelVersion\":\"4.12.0\",\"springBootVersion\":\"3.4.5\",\"quarkusGroupId\":\"io.quarkus.platform\"}"; + + } +} diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/resources/pom-xml-files/quarkus-pom.xml b/dsl/camel-jbang/camel-jbang-core/src/test/resources/pom-xml-files/quarkus-pom.xml new file mode 100644 index 00000000000..4d3da5269e0 --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/test/resources/pom-xml-files/quarkus-pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.demo</groupId> + <artifactId>quarkus-test</artifactId> + <version>1.0.0-SNAPSHOT</version> + <properties> + <compiler-plugin.version>3.13.0</compiler-plugin.version> + <maven.compiler.release>21</maven.compiler.release> + <maven.compiler.source>21</maven.compiler.source> + <maven.compiler.target>21</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <quarkus.package.jar.enabled>true</quarkus.package.jar.enabled> + <quarkus.package.jar.type>uber-jar</quarkus.package.jar.type> + <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> + <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> + <quarkus.platform.version>3.23.0</quarkus.platform.version> + <skipITs>true</skipITs> + <surefire-plugin.version>3.5.2</surefire-plugin.version> + <quarkus.package.jar.enabled>true</quarkus.package.jar.enabled> + <quarkus.package.jar.type>uber-jar</quarkus.package.jar.type> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>${quarkus.platform.group-id}</groupId> + <artifactId>${quarkus.platform.artifact-id}</artifactId> + <version>${quarkus.platform.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>${quarkus.platform.group-id}</groupId> + <artifactId>quarkus-camel-bom</artifactId> + <version>${quarkus.platform.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-arc</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-picocli</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + </dependencies> +</project> diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/resources/pom-xml-files/springboot-pom.xml b/dsl/camel-jbang/camel-jbang-core/src/test/resources/pom-xml-files/springboot-pom.xml new file mode 100644 index 00000000000..38d9eb9b215 --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/test/resources/pom-xml-files/springboot-pom.xml @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>3.4.5</version> + <relativePath/> <!-- lookup parent from repository --> + </parent> + + <groupId>org.example.project</groupId> + <artifactId>my-route</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <java.version>17</java.version> + <project.build.outputTimestamp>2025-06-12T11:19:02Z</project.build.outputTimestamp> + + </properties> + + <dependencyManagement> + <dependencies> + <!-- Spring Boot BOM --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>3.4.5</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <!-- Camel BOM --> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-spring-boot-bom</artifactId> + <version>4.12.0</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-observability-services-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-timer-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-yaml-dsl-starter</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring-junit5</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>camel.debug</id> + <activation> + <property> + <name>camel.debug</name> + <value>true</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-debug-starter</artifactId> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>3.8.1</version> + <executions> + <execution> + <id>copy</id> + <phase>generate-sources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.jolokia</groupId> + <artifactId>jolokia-agent-jvm</artifactId> + <version>2.2.9</version> + <type>jar</type> + <classifier>javaagent</classifier> + </artifactItem> + </artifactItems> + <stripVersion>true</stripVersion> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <jvmArguments>-javaagent:target/dependency/jolokia-agent-jvm-javaagent.jar=port=7878,host=localhost</jvmArguments> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project>