Description
Problem
build-report.json is only written at session end via BuildReportCollector.onSessionEnded().
If the build crashes (OOM, kill -9, uncaught exception that bypasses EventSpy), the
report is lost — including all the diagnostic and timing data collected up to that point.
Proposed fix
Register a JVM shutdown hook in BuildReportCollector that writes a partial report
with whatever data has been collected so far. The report should include a
"status": "CRASHED" or "partial": true field so consumers know it's incomplete.
The normal onSessionEnded() path should deregister the shutdown hook to avoid
double-writing.
Note: kill -9 cannot be intercepted by shutdown hooks. This covers OOM, normal
signals, and uncaught exceptions.
Priority
Low — nice-to-have resilience improvement. The normal path works fine.
Related
- Build report: structured JSON report with per-mojo log capture #12695 — Build report PR
- Build output overhaul: structured build report, diagnostic collector, console modes #12571 — Build output overhaul tracking issue
🤖 Drafted with Claude Code (Claude Opus 4.6). Reviewed and confirmed by @gnodet before submission.
Activity
harshab054 commentedon Oct 18, 2026
Hi Guillaume,
I'd like to contribute an implementation for this enhancement.
I noticed that PR #12695 is still open on "feature/build-report", which is part of the stacked build-output overhaul. Would you prefer that I prepare a follow-up patch against "feature/build-report" now, or wait until the stack is merged into "master" and submit an independent PR?
I want to ensure the contribution fits your planned direction and avoids conflicts with the ongoing work.
Thanks!
codewithsinchana commentedon Nov 11, 2026
Hi, I've implemented a shutdown hook to write a partial build report when Maven terminates unexpectedly before the build session completes. The implementation reuses the existing report collection and persistence logic. Thank you.