This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push: new 44754fc56c4 CAMEL-19322: camel-jbang - Source Dir to support application.properties 44754fc56c4 is described below commit 44754fc56c49010de6d2510ecda58c0d838256e1 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 | 4 ++-- .../java/org/apache/camel/dsl/jbang/core/commands/Run.java | 14 +++++++++----- parent/pom.xml | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml index 0cc4d84d48d..7998a470711 100644 --- a/camel-dependencies/pom.xml +++ b/camel-dependencies/pom.xml @@ -446,7 +446,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> <pooled-jms-version>1.2.4</pooled-jms-version> <powermock-version>2.0.7</powermock-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 f63af35d3ec..590061ca839 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 @@ -149,7 +149,7 @@ public class RouteWatcherReloadStrategy extends FileWatcherResourceReloadStrateg if (name.endsWith(".properties")) { onPropertiesReload(resource, true); } else { - onRouteReload(List.of(resource), true); + onRouteReload(List.of(resource), false); } }); } @@ -190,7 +190,7 @@ public class RouteWatcherReloadStrategy extends FileWatcherResourceReloadStrateg pr.onReload(resource.getLocation(), changed); // trigger all routes to be reloaded if (reloadRoutes) { - onRouteReload(null, true); + onRouteReload(null, 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 46d2c9573a3..93409de5073 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") @@ -616,7 +615,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 @@ -626,9 +630,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 b6c14ff77fe..f46318a4597 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> <pooled-jms-version>1.2.4</pooled-jms-version> <powermock-version>2.0.7</powermock-version>