Skip to content

CAMEL-24659: camel run defaults to the jbang runtime, and --runtime=main runs in a separate JVM - #26226

Merged
davsclaus merged 4 commits into
mainfrom
feature/CAMEL-24659-jbang-runtime
Sep 9, 2026
Merged

CAMEL-24659: camel run defaults to the jbang runtime, and --runtime=main runs in a separate JVM#26226
davsclaus merged 4 commits into
mainfrom
feature/CAMEL-24659-jbang-runtime

Conversation

@davsclaus

@davsclaus davsclaus commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fixes https://issues.apache.org/jira/browse/CAMEL-24659

Motivation

camel run runs the integration in-process inside the Camel CLI (jbang) JVM. That is great for prototyping, but the JVM classpath also contains camel-jbang-core and all its dependencies, so it does not look like a production deployment. --runtime=spring-boot and --runtime=quarkus already export to a temporary project and run via Maven in a clean JVM, and the TUI needs the same for Camel Main so what it observes matches what the user ships.

Changes

  • camel run defaults to a new jbang runtime, which is the existing in-process behaviour. RuntimeType gains jbang and exportRuntime() (jbang exports as main). The shared RuntimeTypeConverter used by camel export, camel dependency, camel version, camel update and the kubernetes plugin treats jbang as an alias for main; Run uses its own converter and completion candidates.
  • --runtime=main now runs in a separate JVM: the sources are exported with ExportCamelMain to .camel-jbang-run/<ts>, packaged with the Maven wrapper, and the runner JAR is started with plain java. camel:run was not used because the camel-maven-plugin runs the main class inside the Maven JVM without forking. Supported: --dev (routes reload from the original source directory), --source-dir, --jvm-args, --jvm-debug, --jfr, --profile, --camel-version and the max duration options. In-process-only options (--background, --code, --open-api, --empty, --mcp-stdio) are rejected with a hint to use --runtime=jbang. An existing pom.xml still runs via mvn camel:run, and runtime detection from the pom only applies under jbang.
  • --console with Camel Main: the dev console is configured in-process by KameletMain, so it was lost on export. camel export gains a --console option (Camel Main runtime only); the silent run records it in the run settings and ExportCamelMain turns it into the camel.management.* settings and dependencies for the dev console, health, info and Jolokia, mirroring KameletMain. camel run --runtime=main --console forwards it. The default jbang runtime is unchanged, so tooling such as Kaoto that relies on camel run --console is unaffected.
  • Logs go to ~/.camel/<name>.log using the camel.main.name of the exported project, which camel log and the TUI Log tab already fall back to.
  • TUI: the F2 run options form always passes --runtime= (so Camel Main launches use the clean JVM) and offers JBang as a fourth choice when the runtime is not locked to a Maven project.
  • Docs: runtimes section in the running guide, 4.23 upgrade guide entry, TUI guide, regenerated command metadata.

Testing

  • New ExportTest cases shouldExportConsoleForCamelMain / shouldNotExportConsoleByDefault verify the exported pom and application.properties.
  • New RuntimeTypeTest; runtime option cases in RunTest and ExportTest; DependencyListTest, DependencyUpdateTest switch and TUI RunOptionsFormTest updated/passing.
  • Manually verified --console: /q/dev, /observe/health and /observe/jolokia answer 200 on the default jbang runtime and on --runtime=main.
  • Manually verified with the 4.23.0-SNAPSHOT CLI: camel run --runtime=main hello.camel.yaml starts a separate java -jar process visible in camel ps, writes the log file, --dev picks up a saved edit within seconds, --max-seconds stops the JVM, and the temp project and log are removed on exit.

Follow-ups not in this PR (tracked in https://issues.apache.org/jira/browse/CAMEL-24661): the Spring Boot and Quarkus exporters do not translate --console (pre-existing), the Spring Boot and Quarkus runs ignore the max duration options in the same way, and the Quarkus run names its log after the export name rather than camel.main.name.

Claude Code on behalf of davsclaus

🤖 Generated with Claude Code

davsclaus and others added 2 commits September 9, 2026 10:15
…ain runs in a separate JVM

The in-process run (inside the Camel CLI JVM) is now the jbang runtime,
which stays the default for camel run as it is the fast prototyping mode.

The main runtime now behaves like spring-boot and quarkus: the sources
are exported to a temporary Camel Main project, packaged with the Maven
wrapper, and the runner JAR is started with plain java. This gives a JVM
with the same classpath as an exported project, which resembles a
production deployment, and is what the TUI prefers when launching
examples and folders (the run options form now always passes the
runtime and offers JBang as an explicit choice).

The Camel Main run supports --dev (routes reload from the original
source directory), --jvm-args, --jvm-debug, --jfr, --profile and the
max duration options. Options that only work in-process (--background,
--code, --open-api, --empty and --mcp-stdio) are rejected with a hint
to use --runtime=jbang. Logs go to ~/.camel/<name>.log, which camel log
and the TUI already fall back to.

All other commands taking --runtime treat jbang as an alias for main.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
The run options form lists all runtimes inline, but the row was too
narrow for four entries so JBang was cut off. Use a short label and
widen the dialog. The runtime stays locked for Maven projects, where
running in-process is not applicable.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
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 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.

…el Main runtime

The developer console is configured in-process by KameletMain, so it
was lost when camel run --runtime=main exported the project. camel
export now has a --console option (Camel Main runtime), which the
silent run records in the run settings and ExportCamelMain turns into
the camel.management settings and dependencies for the dev console,
health, info and Jolokia, mirroring KameletMain. camel run forwards the
option to the export.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Simplify disarrangeLogging: every runtime except the in-process jbang
runtime spawns a separate JVM.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-jbang/camel-jbang-core
  • dsl/camel-jbang/camel-jbang-plugin-tui

🔬 Scalpel shadow comparison — Scalpel: 8 tested, 8 compile-only — current: 6 all tested

Maveniverse Scalpel detected 16 affected modules (current approach: 6).

⚠️ Modules only in Scalpel (10)
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-launcher
  • coverage
  • docs

Skip-tests mode would test 8 modules (3 direct + 5 downstream), skip tests for 8 (generated code, meta-modules)

Modules Scalpel would test (8)
  • camel-jbang-core
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • docs
Modules with tests skipped (8)
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-launcher
  • coverage

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ 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 (16 modules, 3m 29s total)

Total reactor time: 3m 29s

Module Duration Status
Camel :: Launcher 56.6s SUCCESS
Camel :: JBang :: MCP 41.9s SUCCESS
Camel :: JBang :: Plugin :: TUI 40.3s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 24.6s SUCCESS
Camel :: Docs 21.0s SUCCESS
Camel :: JBang :: Plugin :: Testing 11.0s SUCCESS
Camel :: JBang :: Plugin :: Validate 2.6s SUCCESS
Camel :: JBang :: Plugin :: Edit 2.3s SUCCESS
Camel :: Coverage 1.9s SUCCESS
Camel :: JBang :: Plugin :: Generate 1.8s SUCCESS
Camel :: JBang :: Plugin :: MCP 1.4s SUCCESS
Camel :: JBang :: Plugin :: Route Parser 1.4s SUCCESS
Camel :: JBang :: Main 1.3s SUCCESS
Camel :: Launcher :: Container 0.8s SUCCESS
Camel :: JBang :: Integration tests 0.5s SUCCESS
Camel :: JBang :: Core n/a

Top 20 slowest modules:

  • Camel :: Launcher (56.6s)
  • Camel :: JBang :: MCP (41.9s)
  • Camel :: JBang :: Plugin :: TUI (40.3s)
  • Camel :: JBang :: Plugin :: Kubernetes (24.6s)
  • Camel :: Docs (21.0s)
  • Camel :: JBang :: Plugin :: Testing (11.0s)
  • Camel :: JBang :: Plugin :: Validate (2.6s)
  • Camel :: JBang :: Plugin :: Edit (2.3s)
  • Camel :: Coverage (1.9s)
  • Camel :: JBang :: Plugin :: Generate (1.8s)
  • Camel :: JBang :: Plugin :: MCP (1.4s)
  • Camel :: JBang :: Plugin :: Route Parser (1.4s)
  • Camel :: JBang :: Main (1.3s)
  • Camel :: Launcher :: Container (0.8s)
  • Camel :: JBang :: Integration tests (0.5s)

⚙️ View full build and test results

@davsclaus
davsclaus merged commit 935f581 into main Sep 9, 2026
6 checks passed
@davsclaus davsclaus added this to the 4.23.0 milestone Sep 9, 2026
@github-actions
github-actions Bot deleted the feature/CAMEL-24659-jbang-runtime branch September 9, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants