运行ant目标的错误

时间:2014-04-10 10:48:18

标签: java ant junit target

所以我在build.xml文件中使用新目标时遇到了一些麻烦

<target name="consistency">
<description>Consistency</description>
<junit printsummary="withOutAndErr" haltonfailure="yes" haltonerror="yes" dir="${basedir}" showoutput="true" fork="yes" forkmode="once">
 <classpath refid="build.classpath" />
 <batchtest todir="${test.dir}">
  <fileset dir="${test.src.dir}/com/the/dir/is/correct/">
          <include name="ConsistencyCase.java" />
  </fileset>
 </batchtest>   
</junit>

由于错误而失败:

    [junit] Running ConsistencyCase
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

BUILD FAILED
D:\Users\myusername\workspace\projectname\build.xml:410: Test ConsistencyCase failed

Total time: 1 second

由于完全没有日志,我无法弄清楚错误的位置。 我怎样才能让Ant刷新一些错误日志?

1 个答案:

答案 0 :(得分:0)

你可以使用这样的格式化程序:

<target name="consistency">
    <description>Consistency</description>
    <junit printsummary="withOutAndErr" 
            haltonfailure="yes" 
            haltonerror="yes" 
            dir="${basedir}" 
            showoutput="true" 
            fork="yes" forkmode="once">
        <classpath refid="build.classpath" />
        <formatter type="plain" usefile="false" /> 
        <batchtest todir="${test.dir}">
            <fileset dir="${test.src.dir}/com/the/dir/is/correct/">
                <include name="ConsistencyCase.java" />
            </fileset>
        </batchtest>   
    </junit>
</target>
相关问题