title: How to change Ant script with EMMA code-coverage so it can find runtime coverage data?
body: <p>I have following script:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;taskdef resource="emma_ant.properties"&gt;
      &lt;classpath&gt;            
          &lt;pathelement location="lib/emma.jar" /&gt;
          &lt;pathelement location="lib/emma_ant.jar" /&gt;
      &lt;/classpath&gt;
  &lt;/taskdef&gt;
  
  &lt;target name="compile"&gt;
      &lt;mkdir dir="build"/&gt; &lt;!-- vytvori adresar build --&gt;
      &lt;mkdir dir="build/classes"/&gt;
      &lt;mkdir dir="build/test"/&gt;
      &lt;javac destdir="build/classes" srcdir="src" debug="true" /&gt; &lt;!-- prelozi zdrojove kody --&gt;
      &lt;javac destdir="build/test" srcdir="test"&gt; &lt;!-- prelozi testy --&gt;
          &lt;classpath&gt; &lt;!-- pro prelozeni testu je potreba junit a prelozena aplikace --&gt;
              &lt;pathelement location="lib/junit-4.5.jar" /&gt;
              &lt;pathelement location="build/classes" /&gt;
          &lt;/classpath&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;target name="build" depends="compile"&gt;
      &lt;jar destfile="tetris.jar" basedir="build/classes"&gt; &lt;!-- zabali aplikaci do jaru --&gt;
          &lt;manifest&gt;
              &lt;attribute name="Main-Class" value="tetris.Main"/&gt;
              &lt;attribute name="Class-Path" value="lib/mysql-connector-java-5.1.6-bin.jar lib/derbyclient.jar"/&gt;
          &lt;/manifest&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  
  &lt;target name="jar" depends="build"&gt;&lt;/target&gt;
  
  &lt;target name="run" depends="compile"&gt;
      &lt;java classname="tetris.Main" classpath="build/classes"&gt;  &lt;!-- spusti aplikaci --&gt;
          &lt;classpath&gt;
              &lt;pathelement location="lib/mysql-connector-java-5.1.6-bin.jar" /&gt;
              &lt;pathelement location="lib/derbyclient.jar" /&gt;
          &lt;/classpath&gt;
      &lt;/java&gt;
  &lt;/target&gt;
  
  &lt;target name="instrument" depends="compile"&gt;
      &lt;mkdir dir="build/instrumented"/&gt;
  
      &lt;emma verbosity="verbose"&gt; &lt;!-- vytvori tridy upravene pro sledovani coverage --&gt;
          &lt;instr instrpath="build/classes"
                  destdir="build/instrumented"
                  metadatafile="build/metadata.emma"
                  merge="true" /&gt;
      &lt;/emma&gt;
  &lt;/target&gt;
  
  &lt;target name="test" depends="instrument"&gt;
      &lt;mkdir dir="reports" /&gt;
      &lt;mkdir dir="reports/junit" /&gt;
  
      &lt;junit printsummary="yes" haltonfailure="no" fork="true"&gt; &lt;!-- pusti JUnit testy --&gt;
          &lt;classpath&gt;
              &lt;pathelement location="build/test" /&gt;
              &lt;pathelement location="build/classes" /&gt;
              &lt;pathelement location="build/instrumented" /&gt;
              &lt;pathelement location="lib/junit-4.5.jar" /&gt;
              &lt;pathelement location="lib/emma.jar" /&gt;
              &lt;pathelement location="lib/emma_ant.jar" /&gt;
          &lt;/classpath&gt;
  
          &lt;formatter usefile="false" type="brief" /&gt;
          &lt;formatter type="plain"/&gt;
  
          &lt;batchtest fork="yes" todir="reports/junit"&gt; &lt;!-- reporty budou v adresari reports/junit --&gt;
              &lt;fileset dir="test"&gt;
                  &lt;include name="**/TetrisSuite.java"/&gt;
              &lt;/fileset&gt;
          &lt;/batchtest&gt;
          &lt;jvmarg value="-Demma.coverage.out.file=build/coverage.emma"/&gt;
          &lt;jvmarg value="-Demma.coverage.out.merge=true" /&gt;
      &lt;/junit&gt;
  
      &lt;emma enabled="true" verbosity="verbose"&gt; &lt;!-- vygeneruje report emmy --&gt;
          &lt;report sourcepath="src"&gt;
              &lt;fileset dir="build" includes="*.emma" /&gt;
  
              &lt;html outfile="reports/coverage.html" /&gt;
          &lt;/report&gt;
      &lt;/emma&gt;
  &lt;/target&gt;
  
  &lt;target name="clean"&gt;
      &lt;delete dir="build"/&gt; &lt;!-- smaze adresar build --&gt;
      &lt;delete dir="reports"/&gt;
      &lt;delete file="tetris.jar"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p></p>
  
  <p>It outputs this message:</p>
  
  <pre><code>processing input file [...NetBeansProjects/Tetris3/build/metadata.emma] ...
    loaded 25 metadata entries
  1 file(s) read and merged in 5 ms
  nothing to do: no runtime coverage data found in any of the data files
  </code></pre>
  
  <p>What's wrong and how to fix it?</p>