我正在使用 ant jenkins 插件在 1.7.1 版本的 Ant 上运行 ant 任务。由于以下错误,构建失败 -
BUILD FAILED
java.lang.NoSuchMethodError: org.apache.tools.ant.types.resources.Resources.setCache(Z)V
at org.apache.tools.ant.taskdefs.optional.junit.BatchTest.<init>(BatchTest.java:57)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.createBatchTest(JUnitTask.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.IntrospectionHelper$CreateNestedCreator.create(IntrospectionHelper.java:1252)
at org.apache.tools.ant.IntrospectionHelper$Creator.create(IntrospectionHelper.java:1169)
at org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:550)
at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:346)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:198)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
任务:
<target name="test" depends="compile-test" description="to run junits">
<mkdir dir="${build.report}"/>
<property name="junit.path" refid="junit.class.path"/>
<!--<echo message="JUnit classpath ==> ${junit.path}"/>-->
<junit printsummary="yes" fork="no" haltonerror="no" haltonfailure="no">
<classpath refid="junit1.class.path"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${build.report}">
<fileset dir="${src.test}">
<include name="**/Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
相同的任务在我的本地使用相同的设置(包括 ant 版本)可以正常工作。有人可以告诉这里可能的根本原因是什么吗?