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 4d65b419c1f camel-jbang - Run should merge --deps with existing 
dependencies that may be specified in application.properties
4d65b419c1f is described below

commit 4d65b419c1fdabe3e112fb1f257cf1e324286537
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 7 20:28:29 2022 +0100

    camel-jbang - Run should merge --deps with existing dependencies that may 
be specified in application.properties
---
 .../org/apache/camel/dsl/jbang/core/commands/Run.java     | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index dfa27e773df..e38ed10559b 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -345,13 +345,22 @@ class Run extends CamelCommand {
         if (modeline) {
             writeSetting(main, profileProperties, "camel.main.modeline", 
"true");
         }
-        // allow java-dsl to compile to .class which we need in uber-jar mode
-        writeSetting(main, profileProperties, 
"camel.main.routesCompileDirectory", WORK_DIR);
-        writeSetting(main, profileProperties, "camel.jbang.dependencies", 
dependencies);
         writeSetting(main, profileProperties, "camel.jbang.openApi", openapi);
         writeSetting(main, profileProperties, "camel.jbang.repos", repos);
         writeSetting(main, profileProperties, "camel.jbang.health", health ? 
"true" : "false");
         writeSetting(main, profileProperties, "camel.jbang.console", console ? 
"true" : "false");
+        writeSetting(main, profileProperties, 
"camel.main.routesCompileDirectory", WORK_DIR);
+        // merge existing dependencies with --deps
+        String dep = profileProperties != null ? 
profileProperties.getProperty("camel.jbang.dependencies") : null;
+        if (dep == null) {
+            dep = dependencies;
+        } else {
+            dep += "," + dependencies;
+        }
+        if (dep != null) {
+            main.addInitialProperty("camel.jbang.dependencies", dep);
+            writeSettings("camel.jbang.dependencies", dep);
+        }
 
         // command line arguments
         if (property != null) {

Reply via email to