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 d9a8b4942aa CAMEL-19322: camel-jbang - Source Dir to support
application.properties
d9a8b4942aa is described below
commit d9a8b4942aae0e763bd1e0ce56976050984b1a21
Author: Claus Ibsen <[email protected]>
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 4b9b24fb23a..67644729b1a 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -410,7 +410,7 @@
<pdfbox-version>2.0.28</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>3.0.0</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 00707899e7b..df932199758 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
@@ -148,7 +148,7 @@ public class RouteWatcherReloadStrategy extends
FileWatcherResourceReloadStrateg
if (name.endsWith(".properties")) {
onPropertiesReload(resource, true);
} else {
- onRouteReload(List.of(resource), true);
+ onRouteReload(List.of(resource), false);
}
});
}
@@ -189,7 +189,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 f7a42879d57..353d875f9b4 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
@@ -106,8 +106,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")
@@ -618,7 +617,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
@@ -628,9 +632,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 1541e983a44..ed93828a852 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -405,7 +405,7 @@
<pdfbox-version>2.0.28</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>3.0.0</pooled-jms-version>
<powermock-version>2.0.7</powermock-version>