Reputation: 59
So, i'm new using Jetty with Maven, my first project is spamming a hundreds of warnings like
[WARNING] com.google.inject.util.Providers scanned from multiple locations:
jar:file:///C:/Users/pedro/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar!/com/google/inject/util/Providers.class,
jar:file:///C:/Users/pedro/.m2/repository/com/google/inject/guice/4.2.1/guice-4.2.1-no_aop.jar!/com/google/inject/util/Providers.class
I found some answers on the internet that says it is because there is duplicate dependencies, and I have to fix it on the pom.xml
and .classpath
, but I do not have duplicate dependencies and don't know how to fix on the .classpath
.
Someone knows how can i fix it?
Upvotes: 0
Views: 1536
Reputation: 59
I solved it removing the dependency
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.30.v20200611</version>
</dependency>
and keeping only the plugin
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.30.v20200611</version>
</plugin>
Upvotes: 0
Reputation: 49515
That's a legitimate warning.
The bytecode/annotation scanning found that you have multiple locations for the class com.google.inject.util.Providers
.
You have 2 different versions of guice coming from 2 different locations.
With this scenario, the Classloader sometimes uses sisu-guice-2.1.7-noaop.jar
and sometimes it's using guice-4.2.1-no_aop.jar
for that class.
You have a situation where your runtime is unpredictable.
Each time you run the application a different behavior can occur.
Seeing as these are coming from your maven infrastructure, I would recommend running one of the duplicate class finder maven plugins to clean up your dependency tree.
See other question about Find duplicated classes in classpath
Upvotes: 1