CAMEL-24659: camel run defaults to the jbang runtime, and --runtime=main runs in a separate JVM - #26226
Conversation
…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>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
…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>
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 8 tested, 8 compile-only — current: 6 all testedMaveniverse Scalpel detected 16 affected modules (current approach: 6).
|
| 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)
Fixes https://issues.apache.org/jira/browse/CAMEL-24659
Motivation
camel runruns 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-bootand--runtime=quarkusalready 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 rundefaults to a newjbangruntime, which is the existing in-process behaviour.RuntimeTypegainsjbangandexportRuntime()(jbang exports as main). The sharedRuntimeTypeConverterused bycamel export,camel dependency,camel version,camel updateand the kubernetes plugin treatsjbangas an alias formain;Runuses its own converter and completion candidates.--runtime=mainnow runs in a separate JVM: the sources are exported withExportCamelMainto.camel-jbang-run/<ts>, packaged with the Maven wrapper, and the runner JAR is started with plainjava.camel:runwas 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-versionand 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 existingpom.xmlstill runs viamvn camel:run, and runtime detection from the pom only applies underjbang.--consolewith Camel Main: the dev console is configured in-process byKameletMain, so it was lost on export.camel exportgains a--consoleoption (Camel Main runtime only); the silent run records it in the run settings andExportCamelMainturns it into thecamel.management.*settings and dependencies for the dev console, health, info and Jolokia, mirroringKameletMain.camel run --runtime=main --consoleforwards it. The defaultjbangruntime is unchanged, so tooling such as Kaoto that relies oncamel run --consoleis unaffected.~/.camel/<name>.logusing thecamel.main.nameof the exported project, whichcamel logand the TUI Log tab already fall back to.--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.Testing
ExportTestcasesshouldExportConsoleForCamelMain/shouldNotExportConsoleByDefaultverify the exported pom and application.properties.RuntimeTypeTest; runtime option cases inRunTestandExportTest;DependencyListTest,DependencyUpdateTestswitch and TUIRunOptionsFormTestupdated/passing.--console:/q/dev,/observe/healthand/observe/jolokiaanswer 200 on the default jbang runtime and on--runtime=main.camel run --runtime=main hello.camel.yamlstarts a separatejava -jarprocess visible incamel ps, writes the log file,--devpicks up a saved edit within seconds,--max-secondsstops 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 thancamel.main.name.Claude Code on behalf of davsclaus
🤖 Generated with Claude Code