0

Consider the following junit ant target, abridged for readability:

<target name="junit-tests" depends="clean, compile-tests">
    <junit fork="true" showoutput= ...>

        <classpath>...</classpath>
        <formatter.../>
        <jvmarg value=.../>

        <echo message="${test.dist.dir}"/>

        <batchtest todir=...>
            <fileset dir="${test.dist.dir}">
                <include name="**/*Junit.class"/>
            </fileset>
        </batchtest>
    </junit>
</target>       

In order to have verbose debug output for the test.dist.dir variable, I copied the following line from another target in the build.xml file:

<echo message="${test.dist.dir}"/>

But within the junit test target, it fails with:

build.xml:94: junit doesn't support the nested "echo" element.

How do I print debug outputs from a Junit ant task?

Adam Matan
  • 128,757
  • 147
  • 397
  • 562

1 Answers1

1

Put it before the <junit> element:

<target name="junit-tests" depends="clean, compile-tests">
    <echo message="${test.dist.dir}"/>
    <junit fork="true" showoutput= ...>...

There is no point to move it inside since the value of the variable can't change.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820