gnodet opened a new issue, #13562:
URL: https://github.com/apache/maven/issues/13562
## Context
The logging PR stack (#12571) introduces several new event/callback systems
that bypass
the existing v4 `Event → Listener` hierarchy. After the stack lands, Maven
will have
**seven** distinct event/listener/callback patterns:
| System | Pattern | v3/v4 |
|--------|---------|-------|
| `ExecutionEvent` / `ExecutionListener` | Typed events on bus | v4 |
| `RepositoryEvent` / `RepositoryListener` | Typed events on bus | v4 |
| `EventSpy.onEvent(Object)` | Untyped bag | v3 internal |
| `BuildEventListener` | 11 string methods | v3 internal |
| `MojoExecutionListener` / `ProjectExecutionListener` | Direct callbacks |
v3 internal |
| `DiagnosticReporter` | Service (not on bus) | v4 (new) |
| `LogSink` | Direct callback | internal (new) |
The v4 `Event`/`Listener` model is already designed as a unified bus, but
the new
logging additions bypass it.
## Proposal
Extend the v4 `Event` hierarchy so that **all** observable build activity
flows through
a single bus. `DiagnosticReporter` remains a service (producer API for
plugins), but its
implementation emits events onto the bus so consumers subscribe uniformly.
```
Event (base — existing)
├── ExecutionEvent (17 types — existing)
├── RepositoryEvent (19 types — existing, see #13520)
├── DiagnosticEvent (new — wraps BuilderProblem)
├── TransferEvent (new — download progress, missing from v4 entirely)
├── LogEvent (new — significant log messages)
├── CacheEvent (new — for IDE embedders, see #13519)
└── BuildPhaseEvent (new — entering validate/compile/test phase)
```
### Benefits
- **Single `Listener`** can observe everything (execution + diagnostics +
downloads + logs)
- `BuildReportCollector` migrates from v3 `EventSpy` to v4 `Listener`
- Extensions (OTel, build scanners) get a unified stream
- #13520 (repository event listener SPI) fits naturally
- #13519 (cache invalidation for IDE embedders) gets an event type
### Design constraints
- `DiagnosticReporter` stays a service — it's the input API for plugins
- `DiagnosticReporter` implementation emits `DiagnosticEvent` so listeners
can react
- Backward compatibility: `EventSpy` continues to work, `BuildEventListener`
is
deprecated but not removed in 4.1.0
## Sub-issues
- [ ] #13520 — Repository event listener SPI
- [ ] `DiagnosticEvent` — emit from `DiagnosticReporter` onto the v4 event
bus
- [ ] `TransferEvent` — download progress as v4 event (currently no v4
equivalent)
- [ ] `LogEvent` as v4 `Event` subtype — unify with `build.report.LogEvent`
- [ ] `CacheEvent` — for IDE embedder cache invalidation (#13519)
- [ ] `BuildPhaseEvent` — lifecycle phase transitions as events
- [ ] Migrate `BuildReportCollector` from `EventSpy` to v4 `Listener`
## Related
- #12571 — Build output overhaul (parent tracking issue)
- #13520 — Repository event listener SPI
- #13519 — Cache invalidation/eviction SPI for IDE embedders
- #13499 — v4 API/SPI gaps for build extensions
<!-- AI-Agent-Disclosure -->
> 🤖 Drafted with Claude Code (Claude Opus 4.6). Reviewed and confirmed by
@gnodet before submission.
--
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]