gnodet commented on pull request #6: URL: https://github.com/apache/maven-clean-plugin/pull/6#issuecomment-996683801
> > @gnodet the parent IoC is active while classes are visible I think so it should work, or did you mean EventSpy is not exported for plugins (thought it was). You can't call init/close methods since the lifecycle is managed by the dispatcher but calling a "fire" method should be fine. I don't recall without checking if you can inject directly `List<SessionListener>` with guice but it sounds like the solution if it works. > > `EventSpy` is exported, but plugins can not define such beans as they lookup is done in the container's realm which contains extensions, but not plugins afaik. I can double check that with a real test. > > The problem here is that I needed a way for the plugin to be notified when the session ends and this is an unusual case because plugins are not really supposed to outlive their execution. Anyway, the way I found is to use `mavenSession.getRequest().getEventSpyDispatcher().add(spy)` but the `EventSpyDispatcher` class in in the `org.apache.maven.eventspy.internal` package which is not exported. This is bad because the method `getEventSpyDispatcher()` is itself part of the public api. Makes more sense ? Actually, this is quite problematic as the `getEventSpies()` method has been removed from 4.x branch. We definitely need a clean API for that. -- 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]
