我是ant的新手,也是stackoverflow: - )
我在运行junit测试时遇到了这个问题,尝试了不同的解决方法,已经过了2天而我什么也没得到: - (
我mannuly下载了ant-junit jar,因为常春藤说不能为我取回: - (
我的build.xml,只是相关部分:
<property name="FileTest" location="${user.home}/software_construction/hg/armidale_students/build/classes/armidale/api/io"/>
<property name="FileTestFiles" location="${user.home}/software_construction/hg/armidale_students/src/armidale/api/io"/>
<property name="JunitJarLocation" location="${user.home}/software_construction/hg/armidale_students/lib/junit-4.11.jar"/>
<property name="hamcrestLocation" location="${user.home}/software_construction/hg/armidale_students/lib/hamcrest-core-1.3.jar"/>
<property name="antjunitLocation" location="${user.home}/software_construction/hg/armidale_students/lib/ant-junit-1.9.3.jar"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="classpath.test" />
<batchtest todir="${JUnitTestOutput}">
<fileset dir="${FileTestFiles}">
<include name="*Test*.java" />
</fileset>
<formatter type="brief" usefile="false"/>
<formatter type="plain"/>
</batchtest>
</junit>
所以.java文件位于src文件夹中,.class文件位于lib文件夹中 感谢任何回答的人!
更新
<path id="classpath.test">
<pathelement location="${user.home}/software_construction/hg/armidale_students/lib/ant- junit-1.9.3.jar"/>
<pathelement location="${user.home}/software_construction/hg/armidale_students/lib/junit-4.11.jar}"/>
<pathelement path="${FileTest}" />
</path>
我不知道为什么它需要四个空格来生成代码.....无论如何,路径代码如上所述