【问题标题】:How to add ant as dependency to a Jenkins plugin?如何将 ant 作为依赖项添加到 Jenkins 插件?
【发布时间】:2017-08-21 19:46:16
【问题描述】:

我已将以下依赖项添加到 Jenkins 插件中

    <!-- https://mvnrepository.com/artifact/org.apache.ant/ant -->
    <dependency>
        <groupId>org.apache.ant</groupId>
        <artifactId>ant</artifactId>
        <version>1.10.1</version>
    </dependency>

当我执行mvn hpi:run时出现以下错误

[INFO] --- maven-enforcer-plugin:1.4.2.jenkins-1:enforce (display-info) @ osf-builder-suite-for-sfcc-deploy ---
[INFO] Restricted to JDK 1.7 yet org.apache.ant:ant:jar:1.10.1:compile contains org/apache/tools/ant/AntClassLoader$ResourceEnumeration.class targeted to JDK 1.8
[INFO] Restricted to JDK 1.7 yet org.apache.ant:ant-launcher:jar:1.10.1:compile contains org/apache/tools/ant/launch/AntMain.class targeted to JDK 1.8

知道发生了什么,我能做什么?

【问题讨论】:

    标签: maven jenkins ant


    【解决方案1】:

    从 1.10.0 开始,Ant 需要 Java 8,而您的项目显然只能编译到 JDK 7(Maven 通过 maven-enforcer-plugin 检测到这种不兼容性。来自release note

    Ant 1.10.x 在编译或构建时需要 Java8 或更高版本。

    1.9.x 系列将与 Java5 保持兼容。

    切换到 1.9.x 版本应该可以解决该错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-03
      • 2016-03-28
      • 1970-01-01
      • 2012-06-05
      相关资源
      最近更新 更多