davsclaus opened a new pull request, #26526:
URL: https://github.com/apache/camel/pull/26526

   ## Summary
   
   Fixes [CAMEL-24699](https://issues.apache.org/jira/browse/CAMEL-24699).
   
   `camel run pom.xml` on an existing Maven project now logs to 
`~/.camel/<name>.log` for all three runtimes, so `camel log`, the TUI Log tab 
and the MCP log resource can read it — previously only Spring Boot did.
   
   - **Quarkus**: `quarkus.log.file.enabled/path/format` are passed via 
`-Djvm.args` (the same format the export path writes into 
`application.properties`), so the project's own `application.properties` is 
untouched.
   - **Camel Main**: the existing `camel-main-run-log4j2.properties` template 
is rendered into `target/camel-jbang-run-log4j2.properties` and passed as 
`-Dlog4j2.configurationFile` on the Maven command line; it is removed in the 
shutdown hook with the temp pom.
   - The name is `camel.main.name` from the project's `application.properties`, 
or else the Maven artifactId, and is passed to the application as 
`-Dcamel.main.name` so the name it reports (which `camel log`/the TUI fall back 
to for `<name>.log`) always matches the file.
   
   ### Pre-existing problems found while at it
   
   - The Camel Main path passed `--profile`, `--jfr` and `--jvm-args` via 
`-Dcamel.jvmArgs`, which is **not** a `camel-maven-plugin` parameter — 
`camel:run` runs Camel in-process in the Maven JVM (`RunMojo extends 
AbstractExecMojo`), so all three were silently dropped. The profile (and the 
other system properties) now go as plain `-D` on the Maven command line, and 
`--jvm-args`/`--jfr` through `MAVEN_OPTS`.
   - `camel:run` has no `@Execute` phase and does not compile the project, so a 
never-built project failed with `ClassNotFoundException`; `compile` is now run 
first (the Spring Boot/Quarkus paths already run `package`).
   - `--port`, `--prop` and `--max-seconds/--max-messages/--max-idle-seconds` 
were not passed to existing projects; they now are for all three runtimes 
(`server.port` / `quarkus.http.port` / `camel.server.port`, `-Dk=v`, 
`camel.main.durationMax*`).
   
   ### TUI
   
   The TUI had its own Maven launcher (`LaunchManager.launchMavenProject`) with 
the same gap (only Spring Boot got a logback file) and the same `camel.jvmArgs` 
problem. It now runs Maven projects with `camel run pom.xml`, so there is one 
implementation; `translateArgsForMaven`, the pom-injection string surgery and 
the temp-pom bookkeeping are gone (-200 lines).
   
   ## Testing
   
   - New `RunExistingProjectTest` covers the name resolution, the rendered 
log4j2 config (stale log removed, level applied) and the exact argument lists 
for all three runtimes.
   - `camel-jbang-core` and `camel-jbang-plugin-tui` module builds green (1300 
TUI tests).
   - End-to-end with the local snapshot: exported a Camel Main and a Quarkus 
project, ran each with `camel run pom.xml`. Both appear in `camel ps` under 
their artifactId, `~/.camel/e2e-main.log` and `~/.camel/e2e-quarkus.log` are 
written in the shared layout, `--max-seconds` and `--profile` are honoured, and 
the temp pom / log4j2 config are removed when the process stops.
   
   ## Docs
   
   - `camel-jbang-tips.adoc`: the "Running a Maven based project" section was 
stale (claimed it cannot start Spring Boot/Quarkus); rewritten to describe the 
current behaviour, the log file and which options are passed.
   - `camel-jbang-running.adoc` and `camel-jbang-tui.adoc` updated accordingly.
   
   No upgrade-guide entry: no user-facing default or option changed (the TUI 
still launches the same goals; a Quarkus project now only uses `quarkus:dev` 
when *Dev mode* is ticked in the run form, matching `camel run --dev`).
   
   ---
   _Claude Code on behalf of davsclaus_
   


-- 
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]

Reply via email to