title: Ant script to run unit tests from multiple modules and fail the build if a test fails
body: <p>My project has several modules, each having its own build script with a target called "unit-tests"(which runs the unit tests). I created an Ant script that calls the "unit-tests" targets in the modules, runs all the tests and after that generates a <code>junitreport</code> from the output of the executed tests(which is saved in xml files). So far so good, but what I want now is to fail the build if at least one test has failed.</p>
  
  <p>My script now looks something like this, and I need some method of finding out if a the unit tests failed.(I know about the <code>failureproperty</code> in the <code>junit</code> task but I don't know how I could pass that to the calling script)</p>
  
  <pre><code>    ....
  &lt;target name="run-unit-tests" depends="init-output"&gt;
    &lt;ant antfile="${module1}/build.xml" inheritAll="false" target="${junit-target}" /&gt;
    &lt;ant antfile="${module2}/build.xml" inheritAll="false" target="${junit-target}" /&gt;
      ....
  &lt;/target&gt;
  
  &lt;target name="default" depends="run-unit-tests"&gt;
      &lt;junitreport todir="${junit.report.dir}" tofile="TEST-UnitTestSuites.xml"&gt;
          &lt;fileset dir="${junit.output.dir}"&gt;
              &lt;include name="**/TEST-*.xml" /&gt;
          &lt;/fileset&gt;
      &lt;/junitreport&gt;
  
     //----&gt;fail the build if at least one unit tests has failed
  &lt;/target&gt;
  </code></pre>
  
  <p>Any ideas are greatly appreciated. Thanks :)</p>