gnodet opened a new pull request, #12695: URL: https://github.com/apache/maven/pull/12695
## Summary Part 2 of the #12572 split (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 | Layer | Files | Description | |-------|-------|-------------| | API | `BuildReport`, `BuildStatus`, `ModuleReport`, `MojoReport`, `FailureReport` | Immutable interfaces for the report data model | | Impl | `DefaultBuildReport`, `DefaultModuleReport`, `DefaultMojoReport`, `DefaultFailureReport` | Record implementations | | Collector | `BuildReportCollector` | `EventSpy` that tracks lifecycle events and captures log output via `LogEventSink`, routing to mojo/module/build-level buffers | | Writer | `BuildReportJsonWriter` | Zero-dependency JSON serializer with stable field order | | Tests | 3 test classes, 17 tests | Unit tests for collector, JSON writer, and integration | ### Key design decisions - **EventSpy pattern**: `BuildReportCollector` is a `@Named @Singleton` that extends `AbstractEventSpy`, discovered automatically — no wiring changes needed - **Thread-based log routing**: Uses `ConcurrentHashMap<Long, String>` (thread ID → mojo/project key) to associate log events with the correct scope in parallel builds - **Dual sink architecture**: Uses `LogEventSink` (4-arg) independently from the existing `LogSink` (5-arg) used by `ProjectBuildLogAppender` — no interference with console output - **Atomic writes**: Reports are written to a temp file, then atomic-moved into place with a timestamped filename and a `build-report-latest.json` symlink - **Defensive**: `onSessionEnded` wraps report generation in try-catch so report failures never crash the build ### What's NOT in this PR (deferred to later PRs) - BuilderProblem enrichments (key, suggestion, documentationUrl) — PR 4 - Diagnostic collection and warning deduplication — PR 4 - `--warning-mode` CLI flag — PR 4 - Console modes (`--console=plain/rich/machine`) — PR 3 - `mvnlog` viewer tool — PR 5 ### Dependency chain ``` PR 1: #12694 (Logging foundation) ← this builds on it PR 2: THIS PR (Build report) PR 3: Console modes (--console) PR 4: Warning mode + diagnostics PR 5: mvnlog viewer ``` ### Test plan - [x] 17 new unit/integration tests pass - [x] Full Maven test suite passes (same results as base branch) - [ ] CI validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
