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

Robert Reiz picture Robert Reiz · Aug 11, 2013 · Viewed 23k times · Source

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 ??

Answer

Nico picture Nico · Oct 8, 2013

Use a later version of maven-dependency-plugin.

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    .... your configuration here ....
</plugin>