Build report: structured JSON report with per-mojo log capture - #12695
Build report: structured JSON report with per-mojo log capture#12695gnodet wants to merge 1 commit into
Conversation
bae1db9 to
5a5af1e
Compare
602fffb to
056dcf0
Compare
Add the --console CLI flag with four output modes: - plain: compact one-line-per-module output for CI - rich: JLine status bar with live reactor progress - verbose: full mojo-level output (current default) - machine: JSON lines for piping to external tools Part 3 of the #12572 split (depends on build report PR #12695). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
056dcf0 to
a1ee585
Compare
e64db31 to
de8044a
Compare
a1ee585 to
0f31ce2
Compare
Add the --console CLI flag with four output modes: - plain: compact one-line-per-module output for CI - rich: JLine status bar with live reactor progress - verbose: full mojo-level output (current default) - machine: JSON lines for piping to external tools Part 3 of the #12572 split (depends on build report PR #12695). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the --console CLI flag with four output modes: - plain: compact one-line-per-module output for CI - rich: JLine status bar with live reactor progress - verbose: full mojo-level output (current default) - machine: JSON lines for piping to external tools Part 3 of the #12572 split (depends on build report PR #12695). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8083c89 to
170bd72
Compare
Add the --console CLI flag with four output modes: - plain: compact one-line-per-module output for CI - rich: JLine status bar with live reactor progress - verbose: full mojo-level output (current default) - machine: JSON lines for piping to external tools Part 3 of the #12572 split (depends on build report PR #12695). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
170bd72 to
af0cc72
Compare
Add the --console CLI flag with four output modes: - plain: compact one-line-per-module output for CI - rich: JLine status bar with live reactor progress - verbose: full mojo-level output (current default) - machine: JSON lines for piping to external tools Part 3 of the #12572 split (depends on build report PR #12695). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- BuildReport/ModuleReport/MojoReport/FailureReport API interfaces - BuildReportCollector EventSpy tracks lifecycle events and captures log output - BuildReportJsonWriter zero-dependency JSON serializer with stable field order - Thread-based log routing for parallel builds via ConcurrentHashMap - Atomic writes with timestamped filename and build-report-latest.json symlink
8baa65a to
02ac855
Compare
af0cc72 to
3658983
Compare
gnodet
left a comment
There was a problem hiding this comment.
Well-designed build report feature with clean API/impl separation and comprehensive tests. A few issues noted below.
Also noted:
- The architecture is solid: clean API interfaces in maven-api-core, record-based implementations in maven-core, EventSpy pattern for automatic discovery, thread-based log routing for parallel-build safety, atomic file writes with symlink swap.
- The PR correctly depends on PR #12694 (logging foundation) — should not be merged until #12694 lands.
- No test for the
captureLogEventrouting logic (mojo-level vs module-level vs build-level buffers). This is the core routing mechanism and warrants at least one test exercising the dispatch.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
| * Maximum number of log events captured per scope (mojo, module, or build). | ||
| * Beyond this, events are dropped and a truncation notice is appended. | ||
| */ | ||
| static final int MAX_LOG_EVENTS_PER_SCOPE = 500; |
There was a problem hiding this comment.
The Javadoc says "Beyond this, events are dropped and a truncation notice is appended" but captureLogEvent silently drops events without appending any truncation notice. Either append a synthetic LogEvent indicating truncation (e.g. with level WARN and message "... N events truncated"), or update the Javadoc to say events are silently dropped.
| sb.append('}'); | ||
| } | ||
|
|
||
| private static void writeModule(StringBuilder sb, ModuleReport module, int indent) { |
There was a problem hiding this comment.
The hasMore parameter is unused (annotated @SuppressWarnings("unused")) and all call sites pass true. If trailing comma control is no longer needed, the parameter should be removed to reduce confusion.
| private static void writeModule(StringBuilder sb, ModuleReport module, int indent) { | |
| private static void writeNullableField(StringBuilder sb, int indent, String key, String value) { |
Summary
Part 2 of the logging feature chain (depends on #12694 — logging foundation).
Adds a structured build report that captures per-module and per-mojo execution results, timing, log events, and failures as a JSON file at the end of every build.
15 files changed, ~2700 insertions — focused on report data model, collection, and serialization.
What's in this PR
BuildReport,BuildStatus,ModuleReport,MojoReport,FailureReportDefaultBuildReport,DefaultModuleReport,DefaultMojoReport,DefaultFailureReportBuildReportCollectorEventSpythat tracks lifecycle events and captures log output viaLogEventSink, routing to mojo/module/build-level buffersBuildReportJsonWriterKey design decisions
BuildReportCollectoris a@Named @Singletonthat extendsAbstractEventSpy, discovered automatically — no wiring changes neededConcurrentHashMap<Long, String>(thread ID → mojo/project key) to associate log events with the correct scope in parallel buildsLogEventSink(4-arg) independently from the existingLogSink(5-arg) used byProjectBuildLogAppender— no interference with console outputbuild-report-latest.jsonsymlinkonSessionEndedwraps report generation in try-catch so report failures never crash the buildWhat's NOT in this PR (deferred to later PRs)
--warning-modeCLI flag — Warning mode, diagnostic collector, BuilderProblem enrichments #12698--console=plain/rich/machine) — Console modes: --console=plain/rich/verbose/machine #12697mvnlogviewer tool — mvnlog: build log viewer, integration tests, script routing #12699PR chain
mvnlogviewerTest plan
🤖 Generated with Claude Code