问题描述
Maven的3.1.0版本依赖于Eclipse Aether(org.eclipse .aether),而不是Sonatype Aether(org.sonatype.aether).这似乎破坏了依赖于Sonatypeether的插件的兼容性:尝试运行此类插件,您将遇到:
The 3.1.0 release of Maven relies on Eclipse Aether (org.eclipse.aether) instead of Sonatype Aether (org.sonatype.aether).This seems to break compatibility for plugins relying on Sonatype aether : try running such plugins and you'll run into :
java.lang.NoClassDefFoundError: org/sonatype/aether/*
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.*
如 https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound
现在,是否有可能使mojo依赖于以太类()(例如org.sonatype.aether.RepositorySystemSession)同时与Maven 3.0.x和Maven 3.1.x一起运行?
Now, is it possible to make a mojo relying on aether classes (such as org.sonatype.aether.RepositorySystemSession) run both with Maven 3.0.x and Maven 3.1.x ?
还是我必须发布同一插件的两个版本,一个用于3.0.x,一个用于3.1.x?像这样放置执行器规则:
Or do I have to release two versions of the same plugin, one for 3.0.x and one for 3.1.x ? Putting enforcer rules like this :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0,3.1)</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
我已经在Maven开发人员上发布了问题邮件列表,但到目前为止没有答案...
I already posted the question on Maven developers mailing list, but no answer so far...
推荐答案
大多数这些插件取决于能够收集的 Maven依赖树正确的一组依赖关系,无论Maven版本如何.发布了2.1版以支持Sonatype Aether之后的Eclipse Aether如果您的插件可以使用此组件,则应该将您保存.
Most of these plugins depend on the Maven Dependency Tree, which is capable to collect the right set of dependencies no matter the Maven Version. Version 2.1 was released to support Eclipse Aether next to Sonatype AetherIf your plugin can use this component, you should be save.
这篇关于依靠Aether的Maven Mojo可以与Maven 3.0.x和3.1.x兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!