Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 带有junit测试的Ant build.xml布局_Java_Ant_Junit - Fatal编程技术网

Java 带有junit测试的Ant build.xml布局

Java 带有junit测试的Ant build.xml布局,java,ant,junit,Java,Ant,Junit,在一个项目中,我有一个用于所有应用程序源代码的文件夹src和一个用于所有junit测试的不同文件夹测试(两者都具有simular包层次结构) 现在我希望Ant可以运行test文件夹中的所有测试,问题是现在src文件夹中的文件名为“test”的文件也包括在内 这是build.xml中的测试目标: <target name="test" depends="build"> <mkdir dir="reports/tests" /> <junit fork=

在一个项目中,我有一个用于所有应用程序源代码的文件夹src和一个用于所有junit测试的不同文件夹测试(两者都具有simular包层次结构)

现在我希望Ant可以运行test文件夹中的所有测试,问题是现在src文件夹中的文件名为“test”的文件也包括在内

这是build.xml中的测试目标:

<target name="test" depends="build">
    <mkdir dir="reports/tests" />
    <junit fork="yes" printsummary="yes">
      <formatter type="xml"/>
      <classpath>
        <path location="${build}/WEB-INF/classes"/>
        <fileset dir="${projectname.home}/lib">
            <include name="servlet-api.jar"/>
            <include name="httpunit.jar"/>
            <include name="Tidy.jar"/>
            <include name="js.jar"/>
            <include name="junit.jar"/>
        </fileset>
      </classpath>
      <batchtest todir="reports/tests">
        <fileset dir="${build}/WEB-INF/classes">
            <include name="**/*Test.class"/>
        </fileset>
      </batchtest>
    </junit>
</target>

我已将测试文件夹添加到构建目标:

<target name="build" depends="init,init-props,prepare">
    <javac source="1.5" debug="true" destdir="${build}/WEB-INF/classes">
        <src path="src" />
        <src path="test" />
        <classpath refid="classpath"/>
    </javac>
</target>

将test.class文件发布到一个单独的目录中,将此目录添加到任务类路径中,并扫描该辅助目录中的
***test.class