java.lang.ClassNotFoundException: org.sonatype.aet

2019-02-05 22:00发布

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

2条回答
仙女界的扛把子
2楼-- · 2019-02-05 22:36

Use a later version of maven-dependency-plugin.

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    .... your configuration here ....
</plugin>
查看更多
三岁会撩人
3楼-- · 2019-02-05 22:45

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

查看更多
登录 后发表回答