jcgay / maven-profiler

Log Maven mojos execution time
MIT License
113 stars 20 forks source link

Repeated warnings 'Failed to notify spy' when using with another core extension declared in .mvn folder #199

Open jibidus opened 1 year ago

jibidus commented 1 year ago

When I use maven-profiler with another core extension where:

.. I got the following line many times each time a use a maven command :

[WARNING] Failed to notify spy fr.jcgay.maven.profiler.ProfilerEventSpy: null

Here is the stack trace when adding -X parameter:

java.lang.NullPointerException
        at fr.jcgay.maven.profiler.ProfilerEventSpy.onEvent(ProfilerEventSpy.java:81)
        at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104)
        at org.apache.maven.eventspy.internal.EventSpyRepositoryListener.artifactResolved(EventSpyRepositoryListener.java:88)
        [...]

The exception is raised here, in ProfilerEventSpy where onEvent() is called before init(). Do someone know if it is an issue with maven-profiler, or with maven? And how how to solve this issue? I can create a pull request if necessary.

I created a dedicated project for the demonstrate: https://github.com/jibidus/maven-profiler-bug-demo

hazendaz commented 1 year ago

Having same issue.

jcgay commented 6 months ago

Thank you for the very detailed report 👍