title: Jacoco Coverage and Report Task with Ant
body: <p>Hopefully I am posted all the necessary details about this build file. Coverage task works fine and all the test cases runs. </p>
  
  <p><strong>Jacoco.exec</strong> is also generated but report task fails <code>stating Unable to read execution data file C:/path/to/file/jacoco.exec</code>. </p>
  
  <p>Cant figure out what I am doing wrong. Any additions or alternative way ?? 
      
      
      
      </p>
  
  <pre><code>&lt;taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"&gt;
      &lt;classpath path="${JACOCO.HOME}/lib/jacocoant.jar"/&gt;
  &lt;/taskdef&gt;
  
  &lt;target name="runtest" depends="compile"&gt;
      &lt;jacoco:coverage destfile="${testdest}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant" exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" &gt;
          &lt;junit haltonfailure="yes" fork="true" forkmode="once" printsummary="on"&gt;
              &lt;classpath refid="project.classpath" /&gt;
              &lt;classpath location="${testdest}" /&gt;
              &lt;formatter type="xml"/&gt;
              &lt;batchtest fork="yes"&gt;
                  &lt;fileset dir="${testdest}" /&gt;
              &lt;/batchtest&gt;
          &lt;/junit&gt;
      &lt;/jacoco:coverage&gt;
  
      &lt;jacoco:report xmlns:jacoco="antlib:org.jacoco.ant"&gt;
          &lt;executiondata&gt;
              &lt;file file="${testdest}/jacoco.exec" /&gt;
          &lt;/executiondata&gt;
  
          &lt;structure name="Jacoco"&gt;
              &lt;classfiles&gt;
                  &lt;fileset dir="${dest}" /&gt;
              &lt;/classfiles&gt;
              &lt;sourcefiles encoding="UTF-8"&gt;
                  &lt;fileset dir="${src}" /&gt;
              &lt;/sourcefiles&gt;
          &lt;/structure&gt;
  
          &lt;html destdir="${testsrc}/report" /&gt;
      &lt;/jacoco:report&gt;
  </code></pre>
  
  <p></p>