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 2023/10/05 12:12:13 UTC

[camel] branch camel-4.0.x updated: CAMEL-19957: camel-jbang - Avoid adding double kamelet dir if using both --source-dir and --local-kamelet-dir for the same folder.

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

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


The following commit(s) were added to refs/heads/camel-4.0.x by this push:
     new 1cc1fb6eb52 CAMEL-19957: camel-jbang - Avoid adding double kamelet dir if using both --source-dir and --local-kamelet-dir for the same folder.
1cc1fb6eb52 is described below

commit 1cc1fb6eb5201f1c3aa40a8dfcd89637e3efd463
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Oct 5 14:06:49 2023 +0200

    CAMEL-19957: camel-jbang - Avoid adding double kamelet dir if using both --source-dir and --local-kamelet-dir for the same folder.
---
 .../src/main/java/org/apache/camel/main/KameletMain.java         | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index 28905cd166b..00c8ef5dfe2 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -541,10 +541,13 @@ public class KameletMain extends MainCommandLineSupport {
                 reloader.setPattern("*");
                 answer.addService(reloader);
 
-                // add source-dir as location for loading kamelets
+                // add source-dir as location for loading kamelets (if not already included)
                 String loc = this.initialProperties.getProperty("camel.component.kamelet.location");
-                loc = "file:" + sourceDir + "," + loc;
-                addInitialProperty("camel.component.kamelet.location", loc);
+                String target = "file:" + sourceDir + ",";
+                if (!loc.contains(target)) {
+                    loc = target + loc;
+                    addInitialProperty("camel.component.kamelet.location", loc);
+                }
             } else {
                 answer.addService(new DefaultContextReloadStrategy());
             }