You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2026/03/23 13:06:34 UTC
(camel) 01/01: CAMEL-21960: camel-jbang - Auto-detect application.properties in run and export
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch nine-walnut
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1bd1071e27f02c9138d3637330b07be2801fc2fe
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Mar 23 14:06:16 2026 +0100
CAMEL-21960: camel-jbang - Auto-detect application.properties in run and export
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
.../org/apache/camel/dsl/jbang/core/commands/Export.java | 15 +++++++++++++++
.../org/apache/camel/dsl/jbang/core/commands/Run.java | 7 +++++++
2 files changed, 22 insertions(+)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
index 463dcdd9efe3..b97992bdb6c9 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
@@ -95,6 +95,21 @@ public class Export extends ExportBaseCommand {
}
}
+ // auto-detect application.properties and include it
+ {
+ String name = baseDir.resolve("application.properties").toString();
+ if (Files.exists(Paths.get(name)) && !files.contains(name)) {
+ files.add(name);
+ }
+ }
+ if (profile != null) {
+ // need to include profile application properties if exists
+ String name = baseDir.resolve("application-" + profile + ".properties").toString();
+ if (Files.exists(Paths.get(name)) && !files.contains(name)) {
+ files.add(name);
+ }
+ }
+
// application.properties
doLoadAndInitProfileProperties(baseDir.resolve("application.properties"));
if (profile != null) {
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 3c8a946ccb99..30df96a3329c 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
@@ -728,6 +728,13 @@ public class Run extends CamelCommand {
addDependencies(pomDependencies.toArray(new String[0]));
}
+ // auto-detect application.properties and include it
+ if (!empty) {
+ String name = baseDir + "/application.properties";
+ if (Files.exists(Paths.get(name)) && !files.contains(name)) {
+ files.add(name);
+ }
+ }
if (profile != null) {
// need to include profile application properties if exists
String name = baseDir + "/application-" + profile + ".properties";