You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/11/07 19:30:06 UTC

[camel] branch camel-3.18.x updated: camel-jbang - Run should merge --deps with existing dependencies that may be specified in application.properties

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

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


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new 7f27be4762b camel-jbang - Run should merge --deps with existing dependencies that may be specified in application.properties
7f27be4762b is described below

commit 7f27be4762ba62108621033e054ebbd2dd4f272c
Author: Claus Ibsen <cl...@gmail.com>
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 4565495805a..350bddfcc2d 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
@@ -370,13 +370,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) {