我需要使用 ant 来测试我在 Java 中开发的项目。我不能让蚂蚁正常工作。我还没有真正理解如何为 ant 设置路径来正确测试项目需要哪些文件。
期待哪种类型的文件?源还是二进制?
我正在使用这个 ant 文件来运行测试:
<project name="acmetelecom" default="compile">
<property name="src" location="src/acme/com/acmetelecom" />
<property name="src" location="src/acme/com/acmetelecom" />
<property name="fit" location="fit" />
<property name="bin" location="bin" />
<property name="lib" location="lib" />
<property name="report" location="report" />
<property name="junit.report" location="report/junit" />
<property name="fit.report" location="report/fit" />
<path id="lib.classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
<include name="*" />
</fileset>
</path>
<path id="test.classpath">
<path refid="lib.classpath" />
<pathelement location="lib/junit/junit-4.4.jar" />
<pathelement location="lib/junit/junit-4.4-src.jar" />
<pathelement location="${bin}" />
</path>
<target name="compile">
<mkdir dir="${bin}" />
<javac srcdir="${src}" destdir="${bin}">
<classpath refid="lib.classpath" />
</javac>
</target>
<target name="junit" depends="compile">
<mkdir dir="${junit.report}" />
<junit printsummary="yes" fork="yes" haltonfailure="no">
<classpath refid="test.classpath" />
<formatter type="plain" />
<batchtest fork="yes" todir="${junit.report}">
<fileset dir="bin/com/acmetelecom">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="fit" depends="compile">
<mkdir dir="${fit.report}" />
<java classname="fitlibrary.runner.FolderRunner" fork="yes"
failonerror="yes">
<classpath refid="test.classpath" />
<arg value="${fit}" />
<arg value="${fit.report}" />
</java>
<echo>Please see the FIT report page for more details</echo>
</target>
<target name="clean">
<delete dir="${bin}" />
<delete dir="${report}" />
</target>
</project>
我看不出我做错了什么!测试与源代码位于同一目录中。