gnodet commented on PR #13539:
URL: https://github.com/apache/maven/pull/13539#issuecomment-6199360470
Good observation. The fix correctly handles the legacy `EventSpy` path, but
`DependencyResolutionRequest`/`DependencyResolutionResult` events are **not**
forwarded to Maven 4 API listeners at all — that gap exists both before and
after this fix.
`EventSpyImpl` (the bridge in `impl/maven-core`) only handles
`ExecutionEvent` objects:
```java
public void onEvent(Object arg) throws Exception {
if (arg instanceof ExecutionEvent ee) { // only this branch exists
...
}
}
```
When `eventSpyDispatcher.onEvent(result)` is called with a
`DependencyResolutionResult`, `EventSpyImpl` receives it but silently ignores
it — so Maven 4 API `Listener`s registered on the session never see it.
To properly expose this through the Maven 4 API, we'd need:
1. A `DependencyResolutionEvent` interface in `maven-api-core` (extending
`Event`) that exposes the project, the resolution result, and optionally the
exception.
2. A `DependencyResolutionListener` sub-interface of `Listener` with typed
callbacks (`onDependencyResolutionStarted`, `onDependencyResolutionSucceeded`,
`onDependencyResolutionFailed`), analogous to `ExecutionListener` /
`RepositoryListener`.
3. Forwarding in `EventSpyImpl.onEvent()` for `DependencyResolutionRequest`
and `DependencyResolutionResult` instances.
That said, it might be cleaner to handle this as a follow-up rather than
blocking this PR — the current fix is already a self-contained, correct
improvement. The Maven 4 API side would benefit from a separate issue and PR.
--
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]