依靠Aether的Maven Mojo可以与Maven 3.0.x和3.1.x兼容吗? [英] Can a maven mojo relying on Aether be compatible with Maven 3.0.x and 3.1.x?

查看:86
本文介绍了依靠Aether的Maven Mojo可以与Maven 3.0.x和3.1.x兼容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 Aether If your plugin can use this component, you should be save.

这篇关于依靠Aether的Maven Mojo可以与Maven 3.0.x和3.1.x兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆