[
https://issues.apache.org/jira/browse/MNG-7479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17536965#comment-17536965
]
ASF GitHub Bot commented on MNG-7479:
-------------------------------------
laeubi commented on PR #740:
URL: https://github.com/apache/maven/pull/740#issuecomment-1126640803
@cstamas I don't think the javadoc is that strict as you try to depict here.
It only say that EventSpy is a core extension but why should core extension
interfaces not be accessible? Beside that, I even don't see a reason why not an
plugin-extension should be able to receive events, but that's another topic ..
About your links, if you take a closer look at this PR you will see I have
linked exactly your second ref here, sorry if it was not clear enough (I
updated my comment).
> Event spy emits Maven Core events (about processing the build, among them
mojos as well) to some external listener extension.
Not sure if we are talking about the same thing, actually EventSpy is the
"some external listener extension" that *receives* events, the events are
*emitted* by `EventSpyDispatcher` what resides in an internal package and I
don't propose here to export *that* package...
> If you want to "benchmark" Mojo internals, why do you need event spy at
all?
I want to look up **one** specific event spy to inject **additional** events
to that listener so they appear in the report of that plugin as if they where
emitted by maven, maybe I even later on want to emit **custom** ones, the
reason for this is simple, I don't want another implementation or report but
reuse/extend an existing one.
> if you need to interact with your specific event spy, you could inject the
implementation or another interface instead of the `EventSpy` interface which
is meant to be actually used by maven and does not provide any information. Or
do I miss something ?
As the implementation is not controlled by me, the idea was just to have as
less dependencies to it as possible, and for that I can e.g. send a
`RepositoryEvent` to the `EventSpy#onEvent`, so just assume some time later on
the implementation was renamed/moved I need not adjust my code (the implementer
even might consider its implementation as internal, what is perfectly valid). I
think that's the nice thing about the container look-up that I don't need to
bind to the specific implementation but could choose by the role-hint...
> Export the package org.apache.maven.eventspy
> --------------------------------------------
>
> Key: MNG-7479
> URL: https://issues.apache.org/jira/browse/MNG-7479
> Project: Maven
> Issue Type: Improvement
> Components: Core
> Affects Versions: 3.8.5
> Reporter: Christoph Läubrich
> Priority: Major
>
> I'm currently try to fetch a specific EventSpy to inject an event there
> (maven-profiler).
> Sadly in my maven plugin when I try to get it injected:
> @Requirement(role = EventSpy.class, hint = "profiler", optional = true)
> EventSpy eventSpy;
> This results in ClassNotFoundException: org.apache.maven.eventspy.EventSpy
> I noticed that the maven-core do not export the 'org.apache.maven.eventspy'
> package and that is the cause of this, I'd like to suggest to export the
> package as there seem no other standard way to interact/access event spys
> otherwise.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)