Skip to content

feat(mvn): inject -B / --no-transfer-progress to kill noise at source#2449

Open
ryanmurf wants to merge 1 commit into
rtk-ai:developfrom
murphytek:feat/jvm-mvn-flag-injection
Open

feat(mvn): inject -B / --no-transfer-progress to kill noise at source#2449
ryanmurf wants to merge 1 commit into
rtk-ai:developfrom
murphytek:feat/jvm-mvn-flag-injection

Conversation

@ryanmurf

Copy link
Copy Markdown

Summary

The cheapest Maven output to filter is the output that never gets emitted. This teaches rtk mvn to inject two flags into the underlying invocation:

  • -B (batch mode) — suppresses interactive/ANSI output and progress spinners.
  • --no-transfer-progress — suppresses the per-artifact Downloading/Downloaded/Progress log, which can be hundreds of lines on a cold build.

This complements the existing post-hoc filtering — it removes noise at the source so the filter has less to do and the tee'd raw log is smaller too.

Safety

  • Version-gated: --no-transfer-progress only exists in Maven ≥ 3.6.1; older Maven hard-errors on the unknown flag. rtk probes mvn --version once (cached per resolved binary path) and fails CLOSED — if the version can't be determined, nothing is injected.
  • Never double-injects: skipped when the user already passed the flag in long (--batch-mode), short (-B / -ntp), or key=value form.
  • Fully escapable: RTK_NO_INJECT_FLAGS=1 disables all injection for users who need exact raw invocation semantics.

Injection happens in new_mvn_command, so it applies to the filtered phases (test/compile/package/quiet). The -X/-e debug passthrough paths are unaffected.

Testing

New unit tests:

  • mvn --version parsing (full triple, missing-patch defaulting, junk → None)
  • the 3.6.1 threshold boundary
  • RTK_NO_INJECT_FLAGS env semantics (unset/empty/0 → enabled; 1 → disabled)
  • already-present-flag detection across long/short/= forms

Full suite green: cargo fmt --all && cargo clippy --all-targets && cargo test --all (2201 passing).

Context

Part of a series contributing JVM build-tool improvements back upstream (see #2448 for Apache Ant support). Independent of that PR. CLA signed under @ryanmurf.

🤖 Generated with Claude Code

The cheapest way to compress Maven output is to not emit the noise in the
first place. rtk now injects two flags when running mvn:

- `-B` (batch mode) — suppresses interactive/ANSI output
- `--no-transfer-progress` — suppresses the per-artifact download log,
  version-gated to Maven >= 3.6.1 (older Maven hard-errors on the unknown
  flag). The version is probed once via `mvn --version` and cached per
  binary path; probe failure fails CLOSED (no injection).

Injection is skipped when the user already passed the flag (long, short
`-B`/`-ntp`, or `key=value` form) and can be disabled entirely with
`RTK_NO_INJECT_FLAGS=1`.

Adds unit tests for version parsing, the 3.6.1 threshold, the env
kill-switch semantics, and already-present-flag detection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant