Skip to content

camel-jbang: Ensure target directory exists before writing application.properties#23053

Merged
davsclaus merged 1 commit into
apache:mainfrom
smongiar:fix/export-create-directories-before-write
May 7, 2026
Merged

camel-jbang: Ensure target directory exists before writing application.properties#23053
davsclaus merged 1 commit into
apache:mainfrom
smongiar:fix/export-create-directories-before-write

Conversation

@smongiar
Copy link
Copy Markdown
Contributor

@smongiar smongiar commented May 7, 2026

When running camel run in Spring Boot mode, the internal export step calls copySettingsAndProfile() to write application.properties to the build work directory. However, the target directory (src/main/resources inside .camel-jbang/work) may not exist at the time of the write, causing a NoSuchFileException.

This adds a defensive Files.createDirectories() call before writing the file.

java.nio.file.NoSuchFileException: .camel-jbang/work/src/main/resources/application.properties
    at ExportBaseCommand.copySettingsAndProfile(ExportBaseCommand.java:882)
    at ExportSpringBoot.export(ExportSpringBoot.java:119)
    at Run.runSpringBoot(Run.java:1319)
    at Run.run(Run.java:516)
    at Run.doCall(Run.java:399)

…n.properties

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.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions Bot added the dsl label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-core

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-core: 1 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (6 modules)
  • Camel :: JBang :: Core
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container

⚙️ View full build and test results

@davsclaus davsclaus merged commit 5a10684 into apache:main May 7, 2026
6 checks passed
davsclaus pushed a commit that referenced this pull request May 7, 2026
…n.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.
@davsclaus
Copy link
Copy Markdown
Contributor

I have backported to 4.18.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants