davsclaus opened a new pull request, #29916: URL: https://github.com/apache/camel/pull/29916
Item 2 of [CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930). ## Problem For most `camel run` options, the same setting in `application.properties` wins over the option given on the command line: - `RunSettings.write(main, existing, key, value)` takes the file's value first. - `RunProfileProperties.applyTo` does `request.stub = properties.getProperty(STUB, request.stub)` and similar. - `Run.applyProfileProperties` reads the logging options from the file over the flags. CAMEL-24705 moved only `--max-*` and `--port` to the override path. On the launcher from main, with `camel.main.tracing=false` and `camel.jbang.console=false` in `application.properties`: ``` $ camel run hello.yaml --trace --max-seconds=4 # 0 trace lines (28 without the file) $ camel run hello.yaml --console --max-seconds=10 # no HTTP server: curl :8080/q/dev fails ``` ## Change - **Recording.** `Run` records the options given on the command line in the run request (`RunRequest.givenOptions`, from the aesh-parsed options via `CamelCommand.givenOptions()`). - **Choosing the value.** An option that was given wins over the file in all three places. One that was not given takes its value from the file, as before: - `RunProfileProperties.applyTo`: `--maven-settings`, `--maven-settings-security`, `--maven-central-enabled`, `--maven-apache-snapshot-enabled`, `--open-api`, `--package-scan-jars`, `--camel-version`, `--kamelets-version`, `--java-version`, `--gav`, `--stub`, `--data-dir`, `--exclude`. - `RunPipeline.configure` (the new `writeOption`): `--stub`, `--source-dir`, `--data-dir`, `--trace`, `--backlog-trace`, `--modeline`, `--ignore-loading-error`, `--lazy-bean`, `--prompt`, `--gav`, `--open-api`, `--health`, `--metrics`, `--console`, `--mcp`, `--openapi-ui`, `--verbose`, `--jfr`, `--kamelets-version`. The MCP dependency decision (`isMcpEnabled`) follows `--mcp` too. - `Run.applyProfileProperties`: `--logging-level`, `--logging-color`, `--logging-json`. - **How a given option is written.** It is set both as an initial property and as an override property. KameletMain reads the `camel.jbang.*` settings from the initial properties, and camel-main loads the application properties on top of them. With the override alone (as `--port` uses), `--console` would still be off. - **Docs.** A paragraph in "Using properties" (`camel-jbang-running.adoc`), and a 4.24 upgrade-guide entry. Not in this PR: `--background` and `--jvm-debug` (`Run.applyProfileProperties`). #29910 changes those same lines (a JVM a run started no longer reads them), so they follow after it merges. After, on the launcher with the patched jars and the same file: ``` $ camel run hello.yaml --trace --max-seconds=4 # 28 trace lines $ camel run hello.yaml --console --max-seconds=10 # curl :8080/q/dev -> 200 ``` ## Tests - `RunPipelineTest`: a given option wins, as initial and override property, and a not-given option takes the file. The versions and `--stub` given on the command line win in `applyTo`. - `RunTest`: the request knows the options of a parsed command line. A given `--logging-level` wins over `loggingLevel` in the file, and `loggingJson` from the file still applies. - End to end with the launcher, as above. - `RunExportGoldenTest`: the golden files of the six cases that give such options on the command line now also list them under `# override properties`, next to the `--max-*` overrides of CAMEL-24705. Nothing else in them changed. - camel-jbang-run: 306 tests pass. camel-jbang-core: 3000 + 259 pass (`DependencyUpdateTest` and `ExportApiTest` failed once each and passed on the rerun). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
