Repository navigation
Description
Guillaume Nodet opened MNG-8547 and commented
The Session#registerListener() should provide a specific interface to listen to resolver events (wrapping somehow the resolver's org.eclipse.aether.RepositoryListener interface.
Implemented in #13011
The Maven API now exposes both repository and execution events through Maven-owned types, without leaking Resolver types into the public API.
New API types (maven-api-core)
Repository events:
RepositoryListener—@Consumerinterface with 19 default methods, one perRepositoryEventType(artifact/metadata resolve, download, install, deploy, and descriptor events)RepositoryEvent— immutable event object carrying artifact, metadata, repository, path, exception(s), and request traceRepositoryEventType— enum of 19 event kinds
Execution events:
ExecutionListener—@Consumerinterface with 17 default methods, one perExecutionEventTypeExecutionEvent— immutable event object with noun-style accessors (project(),mojoExecution(),exception(),type())ExecutionEventType— enum of 17 event kinds
Shared base:
Event— base interface withsession()accessor; deprecated bridge methods (getType(),getSession(),getProject(),getMojoExecution(),getException()) preserved for backward compatibilityRepositoryMetadata— immutable Maven API wrapper for repository metadata with noun-style accessors (type(),nature(),groupId(),artifactId(),version(),filename())Listenerremains@FunctionalInterface; existing lambdas continue to receive execution events unchanged
Listener registration
Session.registerListener(Listener) / unregisterListener(Listener) / getListeners() accept any Listener instance. Typed listeners (ExecutionListener, RepositoryListener) receive only their event-family callbacks. A single listener can implement both. Registration is thread-safe (CopyOnWriteArrayList) and shared across Maven sessions backed by the same Resolver session. Listener failures are isolated and do not break the build.
Implementation (maven-impl, maven-core)
DefaultRepositoryEvent— maps ResolverRepositoryEventto the Maven API typeMavenRepositoryListener— bridges Resolver events to registeredRepositoryListenerinstancesDefaultRepositorySystemSessionFactory— wires the bridge into the sessionAbstractSession,DefaultEvent,EventSpyImpl,ApiRunner— updated for the unified hierarchy
Activity
goutamadwant commentedon Sep 2, 2026
@gnodet added this enhancement in #13011 using Maven-owned repository event and listener types.let me know if you have any comments or suggestions. Thanks!