Console modes: --console=plain/rich/verbose/machine - #12697
Conversation
602fffb to
056dcf0
Compare
b0617f7 to
1a419b7
Compare
Add --warning-mode CLI flag (summary/all/none/fail) for controlling how build warnings are displayed. Enrich BuilderProblem with key, suggestion, documentationUrl, INFO severity, and a builder API. Add DiagnosticReporter service and DefaultDiagnosticCollector for deduplication across parallel module builds. Part 4 of the #12572 split (depends on console modes PR #12697). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1a419b7 to
1e4c616
Compare
a1ee585 to
0f31ce2
Compare
1e4c616 to
eb4b145
Compare
Add --warning-mode CLI flag (summary/all/none/fail) for controlling how build warnings are displayed. Enrich BuilderProblem with key, suggestion, documentationUrl, INFO severity, and a builder API. Add DiagnosticReporter service and DefaultDiagnosticCollector for deduplication across parallel module builds. Part 4 of the #12572 split (depends on console modes PR #12697). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
eb4b145 to
35cf036
Compare
Add --warning-mode CLI flag (summary/all/none/fail) for controlling how build warnings are displayed. Enrich BuilderProblem with key, suggestion, documentationUrl, INFO severity, and a builder API. Add DiagnosticReporter service and DefaultDiagnosticCollector for deduplication across parallel module builds. Part 4 of the #12572 split (depends on console modes PR #12697). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8083c89 to
170bd72
Compare
35cf036 to
e06f638
Compare
Add --warning-mode CLI flag (summary/all/none/fail) for controlling how build warnings are displayed. Enrich BuilderProblem with key, suggestion, documentationUrl, INFO severity, and a builder API. Add DiagnosticReporter service and DefaultDiagnosticCollector for deduplication across parallel module builds. Part 4 of the #12572 split (depends on console modes PR #12697). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
170bd72 to
af0cc72
Compare
e06f638 to
77ddf3a
Compare
Add --warning-mode CLI flag (summary/all/none/fail) for controlling how build warnings are displayed. Enrich BuilderProblem with key, suggestion, documentationUrl, INFO severity, and a builder API. Add DiagnosticReporter service and DefaultDiagnosticCollector for deduplication across parallel module builds. Part 4 of the #12572 split (depends on console modes PR #12697). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- plain: compact one-line-per-module output, auto-selected in CI - rich: JLine status bar with live reactor progress, auto-selected on TTY - verbose: full mojo-level output, current Maven 4.0 default - machine: JSON lines, one typed JSON object per lifecycle event - Auto-detection: CI → plain, interactive TTY → rich, otherwise → verbose
77ddf3a to
6b6fc7f
Compare
af0cc72 to
3658983
Compare
gnodet
left a comment
There was a problem hiding this comment.
Well-structured PR adding four console modes with comprehensive test coverage (1317 lines of tests). Two issues found, one concurrency bug.
Also noted:
- The
Options.console()API addition follows the established pattern (Optional<String>, same ascolor()). The@Experimentalannotation means downstream breakage is acceptable. - JSON escaping in
MachineBuildEventListenercorrectly handles all RFC 8259 required escapes, with test coverage for edge cases. - Test coverage is strong: 5 new test classes covering all four console modes.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
| @Override | ||
| public void projectFinished(String projectId) { | ||
| activeProjects.remove(projectId); | ||
| completedProjects++; |
There was a problem hiding this comment.
Race condition: completedProjects++ is not atomic. The field is volatile int (line 103) but ++ is a non-atomic read-increment-write compound operation. In parallel builds (-T N), concurrent calls to projectFinished() from worker threads can lose increments, causing the progress counter to under-report.
The same class already uses AtomicInteger for warningCount and errorCount (lines 133-136).
| completedProjects++; | |
| completedProjects.incrementAndGet(); |
(with completedProjects changed to AtomicInteger at line 103)
| * </li> | ||
| * </ol> | ||
| */ | ||
| String determineConsoleMode(MavenContext context) { |
There was a problem hiding this comment.
Unrecognized --console values (including typos like --console=plian) silently fall through to auto-detection. This is inconsistent with the existing --color option in LookupInvoker.java (lines 274-276) which throws IllegalArgumentException for invalid values. Adding validation for consistency would help users catch configuration mistakes.
Summary
Part 3 of the logging feature chain. Depends on #12695 (build report).
Adds the
--consoleCLI flag with four output modes:plain— compact one-line-per-module output, ideal for CI (auto-selected in CI environments)rich— JLine status bar with live reactor progress (auto-selected on interactive TTYs)verbose— full mojo-level output, current Maven 4.0 default behaviormachine— JSON lines: one typed JSON object per lifecycle event, designed for piping to external toolsAuto-detection (
--console=auto, the default): CI → plain, interactive TTY → rich, otherwise → verbose.Files changed (16 files, ~4000 insertions)
Options.java(+console())PlainExecutionEventLogger,RichBuildEventListener,RichExecutionEventLogger,MachineBuildEventListener,MachineExecutionEventLoggerCommonsCliOptions,LayeredOptions,LookupInvoker(preliminary interactive detection),MavenInvoker(console mode switch + transfer listener)ExecutionEventLogger(version info on failure)PR chain
mvnlogviewerTest plan
mvn test -pl impl/maven-cli— all 692 tests passmvn test -pl impl/maven-core— all tests pass🤖 Generated with Claude Code