When building the project with Ant directly I get a coverage report from Jacoco as expected, the .exec file is created and the corresponding reports directory is created in the test/reports directory. When building the project through Jenkins the jacoco.exec file is created but is empty and the actual reports directory is missing. I have tried various path configurations on the Jenkins side thus far without any luck, I am assuming this is some failure of interaction between Jenkins and Ant as the Jacoco plugin for Jenkins simply collects the coverage report output from the build and displays it. I simply want to get a coverage reading on our Jenkins builds, has anyone been down this road? Thank you in advance for any and all assistance/advice.
Edit
Configures environment and runs XXXX tests.
<import file="build.xml" />
<..Properties and DIR values..../>
<!-- COMMMON ......................................................................................................-->
<target name="prepare-jdbc-for-tests">
<!...DB...Setup..ETC./>
</target>
<!-- JACOCO .................................................................................................-->
<taskdef uri = "antlib:org.jacoco.ant" resource = "org/jacoco/ant/antlib.xml">
<classpath path = "${lib.test.dir}/jacocoant.jar"/>
</taskdef>
<target name = "jacoco:report" if="${jacoco}">
<jacoco:report>
<!-- Collected execution data ... -->
<executiondata>
<file file="${test.data.dir}/jacoco.exec" />
</executiondata>
<!-- class files and source files ... -->
<structure name="XXXX Jacoco Coverage Report">
<classfiles>
<fileset dir="${build.classes.dir}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${test.reports.dir}/jacoco-report.html" />
<csv destfile="${test.reports.dir}/report.csv" />
<xml destfile="${test.reports.dir}/report.xml" />
</jacoco:report>
</target>
<....COMPILE TASKS etc...../>
<!-- JUNIT .......................................................................................................-->
<target name="junit-report">
<junitreport todir="${test.data.dir}">
<fileset dir="${test.data.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${test.reports.dir}" />
</junitreport>
</target>
<target name="junit-run-tests" depends="test-compile">
<echo message="included test pattern = ${junit-run-tests.includes}" />
<echo message="excluded test pattern = ${junit-run-tests.excludes}" />
<property name="myclasspath" refid="test.runtime.classpath" />
<echo message="classpath = ${myclasspath}" />
<jacoco:coverage destfile="${test.data.dir}/jacoco.exec" includes= "${junit-run-tests.includes}">
<junit printsummary="false"
haltonfailure="false"
haltonerror="false"
errorProperty="test.failed"
failureProperty="test.failed"
fork="true"
forkMode="once"
maxmemory="1024m">
<classpath location="${build.instrumented.dir}" />
<classpath location="${build.classes.dir}" />
<!-- Ensures instrumented files are searched for first -->
<classpath location="${java.home}/../lib/tools.jar" />
<classpath refid="test.runtime.classpath" />
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<batchtest todir="${test.data.dir}">
<fileset dir="${test.dir}" includes="${junit-run-tests.includes}"
excludes="${junit-run-tests.excludes}" />
</batchtest>
<sysproperty key="build.dir" value="${build.dir}" />
</junit>
</jacoco:coverage>
<antcall target="junit-report" />
<antcall target="jacoco:report" />
<antcall target="open-test-report" />
<!--<fail message="Tests failed. Check log and/or reports" if="test.failed"/>-->
</target>
<!--Integration TEST Task Definitions---/>
...