如何将 ant 添加为 Jenkins 插件的依赖项?
How to add ant as dependency to a Jenkins plugin?
我已将以下依赖项添加到 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
知道发生了什么事以及我能做什么吗?
从 1.10.0 开始,Ant 需要 Java 8,而您的项目显然被限制编译到 JDK 7(Maven 通过 maven-enforcer-plugin 检测到这种不兼容性。从这个release note:
Ant 1.10.x requires Java8 or newer at compile or build time.
The 1.9.x series wil stay compatible with Java5.
切换到 1.9.x 版本应该可以解决错误。
我已将以下依赖项添加到 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
知道发生了什么事以及我能做什么吗?
从 1.10.0 开始,Ant 需要 Java 8,而您的项目显然被限制编译到 JDK 7(Maven 通过 maven-enforcer-plugin 检测到这种不兼容性。从这个release note:
Ant 1.10.x requires Java8 or newer at compile or build time.
The 1.9.x series wil stay compatible with Java5.
切换到 1.9.x 版本应该可以解决错误。