Skip to content

Camel-jbang - adds target java version of exported app (during RUN)#22071

Open
JiriOndrusek wants to merge 4 commits intoapache:mainfrom
JiriOndrusek:camel-jbang-run-custom-java
Open

Camel-jbang - adds target java version of exported app (during RUN)#22071
JiriOndrusek wants to merge 4 commits intoapache:mainfrom
JiriOndrusek:camel-jbang-run-custom-java

Conversation

@JiriOndrusek
Copy link
Contributor

fixes https://issues.apache.org/jira/browse/CAMEL-23208

Adds an option to specify java version for RUN command, so the exported app will use it (this is required to be able to execute RUN with java 17)

Description

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

@github-actions
Copy link
Contributor

🌟 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 build-all, build-dependents, 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 Mar 18, 2026
…letion candidates

- Resolve merge conflicts with apache#22196 (completionCandidates)
- Remove duplicate eq.javaVersion assignments in runQuarkus() and runSpringBoot()
- Add "17" to JavaVersionCompletionCandidates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the docs label Mar 24, 2026
Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code on behalf of Guillaume Nodet

I've merged main into the branch and resolved the merge conflicts with #22196 (completionCandidates). I also fixed:

  1. Duplicate eq.javaVersion assignments — both runQuarkus() and runSpringBoot() had the field set twice (once from the PR, once from the merge with #22196). Removed the duplicates.
  2. Added "17" to JavaVersionCompletionCandidates — the PR's intent to support Java 17 needs to be reflected in the completion candidates (added by #22196), not just in the description string.

Remaining items that need attention:

  • Annotation style inconsistency: The new option in Run.java uses @CommandLine.Option while most other options in the same file use the imported short form @Option
  • No tests: No tests verify the --java-version option is parsed and propagated from Run to the export commands
  • Generated files: camel-jbang-commands-metadata.json and docs need regeneration after adding the new option to Run

@JiriOndrusek
Copy link
Contributor Author

The remaining items were addressed in the latest commit

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second In-Depth Review

Claude Code on behalf of Guillaume Nodet

Thanks for the updates — the test addition addresses one item from the first review. Here's a thorough second pass:

1. Accidental files (blocking)

.superset/config.json and TODO-4.19-ideas.md are unrelated to this PR and should not be committed. Please remove them from the branch.

2. Overlap with CAMEL-23235 (important)

Commit c00319b ("CAMEL-23235: Propagate --java-version option to jbang run/debug commands") was merged to main on March 23 and already implements the core feature this PR was targeting:

  • Added --java-version to Run.java with JavaVersionCompletionCandidates
  • Propagated javaVersion to runQuarkus(), runSpringBoot(), profile settings, jbang args, and ExportBaseCommand

After the merge-with-main in the second commit, the actual new changes in this PR are now limited to:

  1. Annotation style cleanup (@CommandLine.Option@Option) — nice to have
  2. Reordering eq.javaVersion/eq.camelVersion lines — cosmetic
  3. Adding "17" to JavaVersionCompletionCandidates — useful
  4. New RunTest.java — useful but see notes below

The PR description and JIRA should be updated to reflect the reduced scope.

3. Generated metadata not updated (blocking)

The --java-version option for the run command is NOT in camel-jbang-commands-metadata.json. The export command metadata still shows (21, 25) but the code now lists (17, 21, 25). Please regenerate:

mvn install -B -pl dsl/camel-jbang/camel-jbang-core -DskipTests

and commit the updated metadata.

4. Test quality concerns

shouldParseJavaVersion11 — this test passes --java-version=11 and asserts it's accepted. Java 11 is not in the completion candidates and is not supported by Camel 4.x (minimum Java 17). This test documents that any arbitrary string is accepted, which could be confusing. Either:

  • Add validation to reject unsupported versions, or
  • Remove this test and add a comment noting that picocli completion candidates are advisory only, or
  • At minimum rename it to make the intent clear (e.g., shouldAcceptArbitraryJavaVersion)

Tests are shallow — they only verify picocli parsing. They don't test that javaVersion is propagated from Run to ExportQuarkus/ExportSpringBoot. A propagation test (create Run, set javaVersion, call runQuarkus()/runSpringBoot() with a mock, verify the export command received the right value) would add real confidence.

5. Formatting

Please run mvn formatter:format impsort:sort -B -pl dsl/camel-jbang/camel-jbang-core to ensure the new test file passes formatting checks.

Summary

Item Severity
Remove .superset/config.json and TODO-4.19-ideas.md Blocking
Regenerate camel-jbang-commands-metadata.json Blocking
Update PR description for reduced scope (overlap with CAMEL-23235) Suggested
Fix or remove shouldParseJavaVersion11 test Suggested
Add propagation tests Suggested
Run formatter Blocking (CI will fail)

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second In-Depth Review (updated)

Claude Code on behalf of Guillaume Nodet

(Replacing my previous review — the .superset/config.json and TODO-4.19-ideas.md files were introduced by our merge commit, not by this PR. Apologies for the noise.)

Thanks for the updates — the test addition addresses one item from the first review. Here's a thorough second pass:

1. Overlap with CAMEL-23235 (important)

Commit c00319b ("CAMEL-23235: Propagate --java-version option to jbang run/debug commands") was merged to main on March 23 and already implements the core feature this PR was targeting:

  • Added --java-version to Run.java with JavaVersionCompletionCandidates
  • Propagated javaVersion to runQuarkus(), runSpringBoot(), profile settings, jbang args, and ExportBaseCommand

After the merge-with-main in the second commit, the actual new changes in this PR are now limited to:

  1. Annotation style cleanup (@CommandLine.Option@Option) — nice to have
  2. Reordering eq.javaVersion/eq.camelVersion lines — cosmetic
  3. Adding "17" to JavaVersionCompletionCandidates — useful
  4. New RunTest.java — useful but see notes below

The PR description and JIRA should be updated to reflect the reduced scope.

2. Generated metadata not updated (blocking)

The --java-version option for the run command is NOT in camel-jbang-commands-metadata.json. The export command metadata still shows (21, 25) but the code now lists (17, 21, 25). Please regenerate:

mvn install -B -pl dsl/camel-jbang/camel-jbang-core -DskipTests

and commit the updated metadata.

3. Test quality concerns

shouldParseJavaVersion11 — this test passes --java-version=11 and asserts it's accepted. Java 11 is not in the completion candidates and is not supported by Camel 4.x (minimum Java 17). This test documents that any arbitrary string is accepted, which could be confusing. Either:

  • Add validation to reject unsupported versions, or
  • Remove this test and add a comment noting that picocli completion candidates are advisory only, or
  • At minimum rename it to make the intent clear (e.g., shouldAcceptArbitraryJavaVersion)

Tests are shallow — they only verify picocli parsing. They don't test that javaVersion is propagated from Run to ExportQuarkus/ExportSpringBoot. A propagation test (create Run, set javaVersion, call runQuarkus()/runSpringBoot() with a mock, verify the export command received the right value) would add real confidence.

4. Formatting

Please run mvn formatter:format impsort:sort -B -pl dsl/camel-jbang/camel-jbang-core to ensure the new test file passes formatting checks.

Summary

Item Severity
Regenerate camel-jbang-commands-metadata.json Blocking
Update PR description for reduced scope (overlap with CAMEL-23235) Suggested
Fix or remove shouldParseJavaVersion11 test Suggested
Add propagation tests Suggested
Run formatter Blocking (CI will fail)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot removed the docs label Mar 25, 2026
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.

2 participants