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

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


The following commit(s) were added to refs/heads/camel-3.20.x by this push:
     new 2e5dbb9c0de CAMEL-19322: camel-jbang - Source Dir to support 
application.properties
2e5dbb9c0de is described below

commit 2e5dbb9c0dee8004c2c23c3e7c57627abab41849
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun May 7 10:08:48 2023 +0200

    CAMEL-19322: camel-jbang - Source Dir to support application.properties
---
 camel-dependencies/pom.xml                                 |  2 +-
 .../apache/camel/support/RouteWatcherReloadStrategy.java   |  2 +-
 .../java/org/apache/camel/dsl/jbang/core/commands/Run.java | 14 +++++++++-----
 parent/pom.xml                                             |  2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
index e656ed71cf8..9dbba385c9d 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -455,7 +455,7 @@
     <pdfbox-version>2.0.27</pdfbox-version>
     <pgjdbc-driver-version>42.5.1</pgjdbc-driver-version>
     <pgjdbc-ng-driver-version>0.8.9</pgjdbc-ng-driver-version>
-    <picocli-version>4.7.2</picocli-version>
+    <picocli-version>4.7.3</picocli-version>
     <plc4x-version>0.10.0</plc4x-version>
     <powermock-version>2.0.7</powermock-version>
     
<properties-maven-plugin-version>1.0-alpha-2</properties-maven-plugin-version>
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java
index cb78a1224fd..90c773871d6 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java
@@ -144,7 +144,7 @@ public class RouteWatcherReloadStrategy extends 
FileWatcherResourceReloadStrateg
                 if (name.endsWith(".properties")) {
                     onPropertiesReload(resource, true);
                 } else {
-                    onRouteReload(List.of(resource), true);
+                    onRouteReload(List.of(resource), false);
                 }
             });
         }
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 987cdb58f51..b44bbd1b756 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
@@ -105,8 +105,7 @@ public class Run extends CamelCommand {
     List<String> files = new ArrayList<>();
 
     @Option(names = { "--source-dir" },
-            description = "Source directory for loading Camel file(s) to run. 
When using this, then files cannot be specified at the same time."
-                          + " Multiple directories can be specified separated 
by comma.")
+            description = "Source directory for dynamically loading Camel 
file(s) to run. When using this, then files cannot be specified at the same 
time.")
     String sourceDir;
 
     @Option(names = { "--background" }, defaultValue = "false", description = 
"Run in the background")
@@ -615,7 +614,12 @@ public class Run extends CamelCommand {
     private Properties loadProfileProperties() throws Exception {
         Properties answer = null;
 
-        File profilePropertiesFile = new File(getProfile() + ".properties");
+        File profilePropertiesFile;
+        if (sourceDir != null) {
+            profilePropertiesFile = new File(sourceDir, getProfile() + 
".properties");
+        } else {
+            profilePropertiesFile = new File(getProfile() + ".properties");
+        }
         if (profilePropertiesFile.exists()) {
             answer = loadProfileProperties(profilePropertiesFile);
             // logging level/color may be configured in the properties file
@@ -625,9 +629,9 @@ public class Run extends CamelCommand {
             loggingJson
                     = "true".equals(answer.getProperty("loggingJson", 
loggingJson ? "true" : "false"));
             if (propertiesFiles == null) {
-                propertiesFiles = "file:" + getProfile() + ".properties";
+                propertiesFiles = "file:" + profilePropertiesFile.getPath();
             } else {
-                propertiesFiles = propertiesFiles + ",file:" + 
profilePropertiesFile.getName();
+                propertiesFiles = propertiesFiles + ",file:" + 
profilePropertiesFile.getPath();
             }
             repos = answer.getProperty("camel.jbang.repos", repos);
             mavenSettings = answer.getProperty("camel.jbang.maven-settings", 
mavenSettings);
diff --git a/parent/pom.xml b/parent/pom.xml
index c4a54ccd69b..29cf057f32a 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -441,7 +441,7 @@
         <pdfbox-version>2.0.27</pdfbox-version>
         <pgjdbc-driver-version>42.5.1</pgjdbc-driver-version>
         <pgjdbc-ng-driver-version>0.8.9</pgjdbc-ng-driver-version>
-        <picocli-version>4.7.2</picocli-version>
+        <picocli-version>4.7.3</picocli-version>
         <plc4x-version>0.10.0</plc4x-version>
         <powermock-version>2.0.7</powermock-version>
         
<properties-maven-plugin-version>1.0-alpha-2</properties-maven-plugin-version>

Reply via email to