This is an automated email from the ASF dual-hosted git repository.

Croway 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 45f7f5f1286f CAMEL-26558: camel-jbang: keep 
camel-quarkus-microprofile-health when exporting to Quarkus (#29146)
45f7f5f1286f is described below

commit 45f7f5f1286ff84d5de2cb51c1e360b9481ceffb
Author: Thomas Raddatz <[email protected]>
AuthorDate: Wed Nov 4 11:42:26 2026 +0100

    CAMEL-26558: camel-jbang: keep camel-quarkus-microprofile-health when 
exporting to Quarkus (#29146)
    
    camel export --runtime=quarkus dropped camel-quarkus-microprofile-health
    from the exported pom.xml in every spelling of the dependency
    (camel:microprofile-health, org.apache.camel:camel-microprofile-health,
    org.apache.camel.quarkus:camel-quarkus-microprofile-health, also in
    camel.jbang.dependencies): resolveDependencies removed it as an out of
    the box dependency, and buildQuarkusDependencyList skipped it because
    quarkus-pom.ftl was taken to contain it. Since CAMEL-22187 the template
    contains neither the extension nor camel-quarkus-observability-services,
    which brings it along, so the health extension only came with --observe,
    which camel kubernetes export always sets. Now the dependency is exported
    when the project asks for it. camel-quarkus-core is still left to the
    template. camel run --runtime=quarkus exports the project in the same
    way and is fixed as well.
    
    Co-authored-by: Thomas Raddatz <[email protected]>
    Co-authored-by: Claude <[email protected]>
---
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc    | 13 +++++++
 .../camel/dsl/jbang/core/commands/ExportTest.java  | 41 ++++++++++++++++++++++
 .../dsl/jbang/run/export/QuarkusExporter.java      |  6 ++--
 3 files changed, 56 insertions(+), 4 deletions(-)

diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 581a8bd2172b..427e347febad 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -6366,3 +6366,16 @@ created for it), set the `transactionStrategy` option 
explicitly.
 The return type of the protected method 
`JpaEndpoint.createTransactionStrategy()` is now `TransactionStrategy` instead
 of `DefaultTransactionStrategy`. A subclass that overrides it must be 
recompiled: compiled against the old return type,
 its method is no longer called.
+
+=== camel-jbang - the export to Quarkus keeps camel-quarkus-microprofile-health
+
+`camel export --runtime=quarkus`, and `camel run --runtime=quarkus`, which 
exports the same way, now write
+`org.apache.camel.quarkus:camel-quarkus-microprofile-health` to the `pom.xml` 
when the project asks for it:
+`--dep=camel:microprofile-health`, 
`--dep=org.apache.camel:camel-microprofile-health`,
+`--dep=org.apache.camel.quarkus:camel-quarkus-microprofile-health`, or the 
same in `camel.jbang.dependencies`. Before,
+the export dropped it in every spelling, as if the Quarkus POM template 
contained it. Since Camel 4.14 the template
+contains neither the extension nor `camel-quarkus-observability-services`, 
which brings it along.
+
+A project that lists the dependency but does not want the health extension in 
the Quarkus export must remove it.
+Without the dependency nothing changes: the health extension then only comes 
with `--observe` (which
+`camel kubernetes export` always sets), as part of 
`camel-quarkus-observability-services`.
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
index 45c8a85260ac..e5ea17857398 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
@@ -48,6 +48,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.params.provider.ValueSource;
 import org.junitpioneer.jupiter.SetSystemProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -308,6 +309,46 @@ class ExportTest {
         }
     }
 
+    @ParameterizedTest
+    @ValueSource(strings = {
+            "camel:microprofile-health", 
"org.apache.camel:camel-microprofile-health",
+            "org.apache.camel.quarkus:camel-quarkus-microprofile-health" })
+    public void shouldExportMicroProfileHealthToQuarkus(String dep) throws 
Exception {
+        LOG.info("shouldExportMicroProfileHealthToQuarkus {}", dep);
+        Export command = createCommand(RuntimeType.quarkus, new String[] { 
"classpath:route.yaml" },
+                "--gav=examples:route:1.0.0", "--dir=" + workingDir, 
"--quiet", "--dep=" + dep);
+        int exit = command.doCall();
+
+        assertThat(exit).isZero();
+        Model model = readMavenModel();
+        // quarkus-pom.ftl does not contain the extension, so it must come 
from the dependency
+        assertThat(model.getDependencies())
+                .filteredOn(d -> 
"camel-quarkus-microprofile-health".equals(d.getArtifactId()))
+                .singleElement()
+                .satisfies(d -> {
+                    
assertThat(d.getGroupId()).isEqualTo("org.apache.camel.quarkus");
+                    assertThat(d.getVersion()).isNull();
+                });
+    }
+
+    @ParameterizedTest
+    @ValueSource(strings = {
+            "camel:core", "org.apache.camel:camel-core", 
"org.apache.camel.quarkus:camel-quarkus-core" })
+    public void shouldExportCamelQuarkusCoreOnceToQuarkus(String dep) throws 
Exception {
+        LOG.info("shouldExportCamelQuarkusCoreOnceToQuarkus {}", dep);
+        Export command = createCommand(RuntimeType.quarkus, new String[] { 
"classpath:route.yaml" },
+                "--gav=examples:route:1.0.0", "--dir=" + workingDir, 
"--quiet", "--dep=" + dep);
+        int exit = command.doCall();
+
+        assertThat(exit).isZero();
+        Model model = readMavenModel();
+        // quarkus-pom.ftl contains the extension, so the dependency must not 
add it again
+        assertThat(model.getDependencies())
+                .filteredOn(d -> 
"camel-quarkus-core".equals(d.getArtifactId()))
+                .singleElement()
+                .satisfies(d -> 
assertThat(d.getGroupId()).isEqualTo("org.apache.camel.quarkus"));
+    }
+
     @ParameterizedTest
     @MethodSource("runtimeProvider")
     public void shouldExportLazyBean(RuntimeType rt) throws Exception {
diff --git 
a/dsl/camel-jbang/camel-jbang-run/src/main/java/org/apache/camel/dsl/jbang/run/export/QuarkusExporter.java
 
b/dsl/camel-jbang/camel-jbang-run/src/main/java/org/apache/camel/dsl/jbang/run/export/QuarkusExporter.java
index 043075915319..54954f1d0a6b 100644
--- 
a/dsl/camel-jbang/camel-jbang-run/src/main/java/org/apache/camel/dsl/jbang/run/export/QuarkusExporter.java
+++ 
b/dsl/camel-jbang/camel-jbang-run/src/main/java/org/apache/camel/dsl/jbang/run/export/QuarkusExporter.java
@@ -508,9 +508,8 @@ class QuarkusExporter extends Exporter {
 
         List<Map<String, Object>> result = new ArrayList<>();
         for (MavenGav gav : gavs) {
-            // Special case, quarkus-pom.ftl already has them included.
-            if ("camel-quarkus-core".equals(gav.getArtifactId())
-                    || 
"camel-quarkus-microprofile-health".equals(gav.getArtifactId())) {
+            // Special case, quarkus-pom.ftl already has it included.
+            if ("camel-quarkus-core".equals(gav.getArtifactId())) {
                 continue;
             }
             Map<String, Object> dep = new HashMap<>();
@@ -551,7 +550,6 @@ class QuarkusExporter extends Exporter {
 
         // remove out of the box dependencies
         answer.removeIf(s -> s.contains("camel-core"));
-        answer.removeIf(s -> s.contains("camel-microprofile-health"));
 
         if (request.hawtio) {
             answer.add("mvn:org.apache.camel:camel-management");

Reply via email to