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

davsclaus pushed a commit to branch fix/CAMEL-24247
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/fix/CAMEL-24247 by this push:
     new d637bde513e7 CAMEL-24247: Address review feedback
d637bde513e7 is described below

commit d637bde513e793065486aa476794f49bb29eab1e
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jul 23 10:08:43 2026 +0200

    CAMEL-24247: Address review feedback
    
    Use camel: shorthand instead of mvn: format for micrometer-prometheus and
    health dependencies. The Set naturally deduplicates identical strings,
    avoiding the need for a removeIf workaround. Added test to verify no
    duplicate camel-micrometer-prometheus in exported pom.xml.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/ExportCamelMain.java   |  5 ++--
 .../camel/dsl/jbang/core/commands/ExportTest.java  | 27 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportCamelMain.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportCamelMain.java
index 24eb39095275..2f84107492c3 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportCamelMain.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportCamelMain.java
@@ -292,7 +292,6 @@ class ExportCamelMain extends Export {
         answer.removeIf(s -> s.contains("camel-core"));
         answer.removeIf(s -> s.contains("camel-main"));
         answer.removeIf(s -> s.contains("camel-health"));
-        answer.removeIf(s -> s.contains("camel-micrometer-prometheus"));
         // spring-boot-starter JARs are not usable in camel-main runtime
         answer.removeIf(s -> s.contains("spring-boot-starter"));
 
@@ -303,11 +302,11 @@ class ExportCamelMain extends Export {
             if (prop.containsKey("camel.metrics.enabled")
                     || prop.containsKey("camel.management.metricsEnabled")
                     || prop.containsKey("camel.server.metricsEnabled")) {
-                answer.add("mvn:org.apache.camel:camel-micrometer-prometheus");
+                answer.add("camel:micrometer-prometheus");
             }
             // if health-check is defined then include camel-health for 
camel-main runtime
             if (prop.containsKey("camel.management.healthCheckEnabled")) {
-                answer.add("mvn:org.apache.camel:camel-health");
+                answer.add("camel:health");
             }
         }
 
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 3f943ff9eae0..e4b45890ae7b 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
@@ -1048,6 +1048,33 @@ class ExportTest {
         }
     }
 
+    @Test
+    void shouldNotDuplicateMetricsDependency() throws Exception {
+        File profile = new File(".", "application.properties");
+        try {
+            Files.writeString(profile.toPath(), 
"camel.management.metricsEnabled=true\n");
+
+            Export command = new Export(new CamelJBangMain());
+            CommandLine.populateCommand(command,
+                    "--gav=examples:route:1.0.0", "--dir=" + workingDir, 
"--quiet",
+                    "--runtime=camel-main",
+                    "src/test/resources/route.yaml");
+            int exit = command.doCall();
+
+            assertThat(exit).isEqualTo(0);
+            Model model = readMavenModel();
+
+            long count = model.getDependencies().stream()
+                    .filter(d -> 
"camel-micrometer-prometheus".equals(d.getArtifactId()))
+                    .count();
+            assertThat(count)
+                    .as("camel-micrometer-prometheus should appear exactly 
once")
+                    .isEqualTo(1);
+        } finally {
+            FileUtil.deleteFile(profile);
+        }
+    }
+
     @ParameterizedTest
     @MethodSource("runtimeProvider")
     public void shouldContainJibProfile(RuntimeType rt) throws Exception {

Reply via email to