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

Croway pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new 9f5c46813c36 [backport camel-4.22.x] CAMEL-24628: camel-cli - camel 
dependency update propagate route files to export pipeline
9f5c46813c36 is described below

commit 9f5c46813c361d5a2727c9c6f40391bfca2eefa2
Author: Dominik Jelinek <[email protected]>
AuthorDate: Fri Sep 4 11:16:52 2026 +0200

    [backport camel-4.22.x] CAMEL-24628: camel-cli - camel dependency update 
propagate route files to export pipeline
    
    ## Problem
    
    Since CAMEL-22544, `camel dependency update pom.xml route.camel.yaml`
    silently drops the route file and resolves zero dependencies.
    
    The `@Parameters(arity="1..*")` change causes all positional arguments
    to be consumed by `DependencyUpdate.targetFiles`. Non-update files
    (YAML/XML route definitions) are correctly classified but never
    propagated to `ExportBaseCommand.files`, so the export pipeline runs
    with no routes and discovers no components.
    
    This is a regression from Camel 4.20, where `arity="1"` let the second
    positional flow to `ExportBaseCommand.files` via `FilesConsumer`.
    
    IDE tooling uses this two-argument calling convention, as confirmed by
    prior issues CAMEL-22447 and CAMEL-22446.
    
    ## Fix
    
    Add an `else` branch in `DependencyUpdate.doCall()` that forwards
    non-target files (YAML, XML routes) to `this.files` for the export
    pipeline — exactly as the `@Parameters` description already promises.
    
    Add a test that passes both `pom.xml` and a route file as positional
    arguments to verify the route is used for dependency resolution.
    
    Co-authored-by: Claude Opus 4.6 <[email protected]
---
 .../dsl/jbang/core/commands/DependencyUpdate.java  |  4 +++
 .../jbang/core/commands/DependencyUpdateTest.java  | 37 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdate.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdate.java
index e74f36c1f018..9ab914b41be3 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdate.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdate.java
@@ -93,6 +93,10 @@ public class DependencyUpdate extends DependencyList {
             String ext = FileUtil.onlyExt(name, true);
             if ("pom.xml".equals(name) || "java".equals(ext)) {
                 updateTargets.add(file);
+            } else {
+                // route definition files (YAML, XML) are used as source files
+                // for the export pipeline dependency resolution
+                this.files.add(file.toString());
             }
         }
 
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdateTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdateTest.java
index bcf23f29c42a..ea193d21789c 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdateTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyUpdateTest.java
@@ -132,6 +132,43 @@ class DependencyUpdateTest extends 
CamelCommandBaseTestSupport {
         Assertions.assertEquals(0, exportCommand.doCall(), 
exportCommandPrinter.getLines().toString());
     }
 
+    // ==================== explicit route file as positional argument 
====================
+
+    @ParameterizedTest
+    @MethodSource("runtimeProvider")
+    void shouldDependencyUpdateWithExplicitRouteFile(RuntimeType rt) throws 
Exception {
+        prepareFixtureProject(rt);
+
+        // add arangodb to the route
+        addArangodbToCamelFile();
+
+        // pass BOTH pom.xml AND route file as positional arguments
+        // (this is the calling convention used by IDE tooling)
+        StringPrinter updatePrinter = new StringPrinter();
+        DependencyUpdate command = new DependencyUpdate(new 
CamelJBangMain().withPrinter(updatePrinter));
+        CommandLine.populateCommand(command,
+                "--camel-version=4.13.0",
+                "--dir=" + workingDir,
+                CamelCommandBaseTestSupport.quarkusExtRegistry(),
+                new File(workingDir, "pom.xml").getAbsolutePath(),
+                new File(workingDir, 
"src/main/resources/camel/my.camel.yaml").getAbsolutePath());
+        int exit = command.doCall();
+        Assertions.assertEquals(0, exit, updatePrinter.getLines().toString());
+
+        String pomContent = Files.readString(new File(workingDir, 
"pom.xml").toPath());
+        switch (rt) {
+            case quarkus:
+                assertThat(pomContent).contains("camel-quarkus-arangodb");
+                break;
+            case springBoot:
+                assertThat(pomContent).contains("camel-arangodb-starter");
+                break;
+            case main:
+                assertThat(pomContent).contains("camel-arangodb<");
+                break;
+        }
+    }
+
     // ==================== scan-routes with Maven (fixture-based tests) 
====================
 
     @ParameterizedTest

Reply via email to