我对ant和stackoverflow都是新手:-)
我在运行junit测试时遇到了这个问题,尝试了不同的方法来解决它,已经两天了,我什么也没有得到:-(
我手动下载了ant-junit jar,因为ivy说它不能为我进行检索:-(
我的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>我不知道为什么它需要四个空格来生成code.....anyway,路径代码如下
发布于 2014-04-13 00:00:42
请看一下这个模板项目的build.xml:https://github.com/mplacona/java-junit-template-project
https://stackoverflow.com/questions/23025472
复制相似问题