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 2026/05/07 14:58:44 UTC
(camel) branch camel-4.18.x updated: camel-jbang: Ensure target directory exists before writing application.properties (#23053)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.18.x by this push:
new ce31e99a0ac0 camel-jbang: Ensure target directory exists before writing application.properties (#23053)
ce31e99a0ac0 is described below
commit ce31e99a0ac00aa04083e3cf5c5e12cd660e8492
Author: Salvatore Mongiardo <sm...@redhat.com>
AuthorDate: Thu May 7 16:57:08 2026 +0200
camel-jbang: Ensure target directory exists before writing application.properties (#23053)
copySettingsAndProfile() can fail with NoSuchFileException when the
target directory does not yet exist. This happens when camel-launcher
runs in Spring Boot mode (Run.runSpringBoot -> ExportSpringBoot.export)
and the build work directory is not fully prepared before the write.
Add Files.createDirectories() before writing the file to make the
method defensive against missing parent directories.
---
.../java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
index 1a5840cb96e6..767f559aac68 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
@@ -876,6 +876,7 @@ public abstract class ExportBaseCommand extends CamelCommand {
}
// write all the properties
+ Files.createDirectories(targetDir);
Path appPropsPath = targetDir.resolve("application.properties");
Files.writeString(appPropsPath, content.toString(), StandardCharsets.UTF_8);
}