Build Report Foundation — structured report, console modes, warning control - #12572
Draft
gnodet wants to merge 5 commits into
Draft
Build Report Foundation — structured report, console modes, warning control#12572gnodet wants to merge 5 commits into
gnodet wants to merge 5 commits into
Conversation
3 tasks
gnodet
force-pushed
the
feature/12571-build-report
branch
5 times, most recently
from
July 29, 2026 14:32
86a1ef4 to
3192bb4
Compare
…s, warning control Implements the build output overhaul proposed in #12571: - Structured BuildReport data model (BuildReport → ModuleReport → MojoReport) with JSON persistence to target/build-reports/ - DiagnosticCollector for deduplicated warning summaries with counts, suggestions, and doc URLs - Four --console modes: plain (CI), rich (TTY status bar), machine (JSON lines), verbose (Maven 4.0 default) - --warning-mode flag: summary (default), all, none, fail - Log.warn() interception for Maven 3 plugin warnings with synthetic dedup keys - Per-key diagnostic suppression via -Dmaven.diagnostic.suppress Rich mode uses JLine Display in non-fullscreen mode for a live status bar showing active modules, reactor progress, and download activity. All rich mode output bypasses SLF4J (routed through BuildEventListener.log) to avoid the ProjectBuildLogAppender filter chain. Warning/error counts are tracked and shown in the compact end-of-build summary. Machine mode emits one JSON object per line with typed events and ISO-8601 timestamps, designed for tools and LLM agents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
force-pushed
the
feature/12571-build-report
branch
from
July 29, 2026 14:59
3192bb4 to
87be78e
Compare
Add a lightweight tool to view previous build reports without running a full Maven build. Available both as a standalone `mvnlog` command and as a `mvnlog` subcommand within `mvnsh`. - LogOptions API with --diagnostics, --failures, --full, --list flags - LogInvoker skips DI container setup for fast startup - BuildReportRenderer shared between standalone and shell modes - SimpleJsonReader zero-dependency recursive descent JSON parser - Shell wrapper scripts for Unix and Windows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ith parent -l (--log-file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 12 ITs covering the full Build Report Foundation feature: - Build report JSON generation (single-module and multi-module) - Console modes: plain, machine, verbose, auto+CI detection - Warning mode suppression (--warning-mode=none) - Version info displayed on build failure - mvnlog viewer: summary, full view, list reports, no-report error Also fix shell script routing-flag passthrough: --debug, --yjp, --enc, --shell, --up, and --log are now stripped from $@ / %* before invoking Java, preventing Commons CLI partial-match collisions (e.g. --log was prefix-matching --log-file). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mvnlog --json outputs the raw build report JSON to stdout, making it easy to pipe to jq or other tools for programmatic consumption: mvnlog --json | jq '.modules[].artifactId' Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the build output overhaul proposed in #12571: a structured
BuildReportdata model with JSON persistence, aDiagnosticCollectorfor deduplicated warning summaries, four--consolemodes (plain,rich,machine,verbose), a--warning-modeCLI flag, automaticLog.warn()interception for Maven 3 plugin warnings, per-key diagnostic suppression, and amvnlogbuild report viewer.What's included
Structured Build Report
BuildReport→ModuleReport→MojoReportdata model inmaven-api-corewithid()andfindModule()/findMojo()lookup methodsLogEventFailureReportwith timestamp, exception type, and stack traceBuildReportCollector(EventSpy,@Named @Singleton) — captures lifecycle eventsBuildReportJsonWriter— hand-written JSON serializer (no library dependency)target/build-reports/build-report-latest.jsonat session end, with timestamped historyorg.apache.maven.api.build.reportsub-packageDiagnosticCollector + Warning Summary
Diagnostic/DiagnosticCollector/DiagnosticSummaryAPIDefaultDiagnosticCollector— thread-safe (ConcurrentHashMap+LongAdder), dedup by key, capped at 1000build-report.jsonConsole Modes (
--console)--console=auto(default)plain; TTY →rich; otherwise →verbose--console=plain--console=rich--console=verbose--console=machinePlain mode: compact footer, no ANSI control sequences.
Rich mode: live
Displaybar showing active modules,[n/total]progress, elapsed time, download progress. All output bypasses SLF4J (routed throughBuildEventListener.log()) to avoid theProjectBuildLogAppenderfilter chain. Warning/error counts are tracked and shown in the compact end-of-build summary. Falls back gracefully on dumb terminals.Machine mode: one JSON object per line with typed
"event"field and ISO-8601 timestamps. Events:build.started/finished,module.started/succeeded/failed/skipped,mojo.*,fork.*,transfer.*.Warning Mode, Log Interception, Diagnostic Suppression
--warning-mode=summary(default)--warning-mode=all--warning-mode=none--warning-mode=failDiagnosticCollectorvia synthetic dedup keys (auto:<LoggerSuffix>:<hexHash>), with file-coordinate stripping so the same warning from different files deduplicates-Dmaven.diagnostic.suppress=<key>— suppress diagnostics by exact key or prefix wildcard (auto:*)Version Info on Failure (MNG-7372)
On
BUILD FAILURE, all console modes now display the Maven version and Java version/vendor in the summary. This helps with bug reports and Stack Overflow questions wherejava -versionoutput may not match the JDK Maven actually used.Build Report Viewer (
mvnlog)A lightweight tool to view previous build reports without running a full Maven build or an external plugin. Available in two forms:
mvnlog(ormvn --log) — skips DI container setup for fast startupmvnloginsidemvnsh— shares the shell session context--diagnostics/-d--failures/-f--full/-F--list/-Ltarget/build-reports/Positional argument accepts a path to a specific report file; defaults to
target/build-reports/build-report-latest.json.Key implementation details:
LogInvokerextendsLookupInvokerbut overridesdoInvoke()to skip the heavyweight DI container, settings, and repository setupSimpleJsonReader— zero-dependency recursive descent JSON parser (matches the zero-dependency spirit ofBuildReportJsonWriter)BuildReportRenderer— shared rendering logic between standalone andmvnshsubcommand viaConsumer<String>output patternLogOptionsAPI interface withCommonsCliLogOptionsCLI parsingmvnlog/mvnlog.cmd) for Unix and WindowsShell Script Routing-Flag Fix
The
mvn/mvn.cmdlauncher scripts now strip routing flags (--debug,--yjp,--enc,--shell,--up,--log) from the argument list before invoking Java. Previously these flags were consumed byhandle_args()to setMAVEN_MAIN_CLASSbut still passed through in$@/%*, where Commons CLI's partial long-option matching would collide (e.g.--logprefix-matched--log-file, causingmvnlog --helpto crash).What's NOT included (separate work)
Diagnosticobjects)Tests
74 unit tests across 12 test classes covering report assembly, JSON serialization, diagnostic dedup/suppression/concurrency, all console modes, warning modes, SLF4J bypass verification, warning summary display, version-on-failure behavior, JSON parsing, and build report rendering.
12 integration tests (
MavenITgh12571BuildReportTest) covering end-to-end behavior:plain,machine,verbose,autowithCI=true--warning-mode=nonesuppresses diagnosticsmvnlogviewer: summary view,--fullper-module detail,--listreports, error when no report existsIntegration tests that assert on verbose log output explicitly set
--console=verboseto work correctly under CI auto-detection.Supersedes
This PR supersedes and unifies the following open issues:
CIenv variable #11088 — Change maven CLI defaults based onCIenv variable (--console=autoauto-detects CI)build-report.jsonprovides per-mojo timing)Related:
-Tis a separate decision)