Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.ClassNotFoundException: org.sonatype.aether.version.InvalidVersionSpecificationException

I am using the maven indexer to fetch the maven index from the maven central repository. Since I updated from org.sonatype.aether to org.eclipse.aether and from maven 3.0.5 to maven 3.1.0 I am getting this Exception.

Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.version.InvalidVersionSpecificationException
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)

Maven tells me that I should check out this page: http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound. Did that. But on the page they just say that they are aware of this problem and they updated some maven plugins to run with maven 3.1.0. But they don't say what is the problem and how to solve it. That is not very useful. What I have to change to make my own plugin work with maven 3.1.0 ???

I double checked my dependencies with:

mvn dependency:tree

And it seems that the old org.sonatype.aether.aether-api.jar is still in the project, which contains the Exception. So basically the org.sonatype.aether.version.InvalidVersionSpecificationException is part of my project. So why do I get this Exception ??

like image 313
Robert Reiz Avatar asked Aug 11 '13 06:08

Robert Reiz


3 Answers

Use a later version of maven-dependency-plugin.

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    .... your configuration here ....
</plugin>
like image 179
Nico Avatar answered Oct 23 '22 22:10

Nico


This error is caused by the Maven 3.1-alpha-1 migration from Sonatype Aether to Eclipse Aether, which is an incompatible change for some plugins.

To support this change, new versions of the affected plugins have been published which work both with Maven 3.0.x and 3.1.x. A list of affected plug-ins and their minimum needed version is available at https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound

like image 42
Javaru Avatar answered Oct 23 '22 23:10

Javaru


Converting my previous comment into an answer, you can use:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:tree

Naturally, you can specify any version.

like image 1
acdcjunior Avatar answered Oct 24 '22 00:10

acdcjunior