gnodet opened a new issue, #13807:
URL: https://github.com/apache/maven/issues/13807
## Summary
The Maven v4 API has `ExecutionListener` and `RepositoryListener` in
`maven-api-core`, both extending `Listener`, with corresponding event types
extending `Event`. There is currently no equivalent for project-level lifecycle
callbacks (before/after project execution, with access to the execution plan
and failure information).
## Proposed additions in `maven-api-core`
### `ProjectExecutionEvent extends Event`
```java
@Experimental
@Immutable
public interface ProjectExecutionEvent extends Event {
/** The project whose lifecycle is being executed. */
@Nonnull Project project();
/** Immutable snapshot of the project's execution plan (list of
MojoExecution). */
@Nonnull List<MojoExecution> executionPlan();
/** The failure that ended project execution, or empty when successful
or not yet started. */
@Nonnull Optional<Throwable> failure();
}
```
### `ProjectExecutionListener extends Listener`
```java
@Experimental
@Consumer
@ThreadSafe
public interface ProjectExecutionListener extends Listener {
default void beforeProjectExecution(@Nonnull ProjectExecutionEvent
event) {}
default void afterProjectExecution(@Nonnull ProjectExecutionEvent event)
{}
}
```
## Relationship to existing types
- Complements `ExecutionListener` (which covers session-level and mojo-level
events) with project-level granularity including access to the full execution
plan.
- `afterSessionEnd` coverage is already handled by
`ExecutionListener.sessionEnded()`.
- Dispatch follows the existing `EventSpyImpl` pattern: exceptions are
caught, logged as WARN, and swallowed — listeners are observers and cannot
abort the build.
## Auto-discovery
Implementations should be auto-discoverable as core extensions without
requiring manual `Session.registerListener()` calls. See #13805 for the general
`SpiService + Listener` auto-discovery mechanism.
## Related
- #13514 — lifecycle participation SPI (afterProjectsRead)
- #13805 — Listener auto-discovery as SpiService
- #9285 — original request for per-project lifecycle callbacks
- #13464 — lifecycle engine migration to v4 API
--
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]