I am not able to get Source file information while generating the report of Jacoco code Coverage.I even tried debug="on" while compiling the file and in the tag <sourcefile> and <classfile > i mentioned the correct path of source directory of java and class file respectively But then also it is showing me the same error.Can someday help me to rectify this error? Here is my code.
<target name="jacocoTests" depends="buildServerTests" description="run tests with cobertura" >
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/jacocoant.jar"/>
</taskdef>
<jacocoTestsParameterized targetClassDir="${SELECTED_TEST_CLASS_DIRECTORY}" classFilterInclude="${SELECTED_TEST_CLASS_NAME}" classFilterExclude="${SELECTED_TEST_CLASS_EXCLUDE_NAME}" />
</target>
<macrodef name="jacocoTestsParameterized" description="execute Jacoco with parameters" >
<attribute name="targetClassDir" default="ServerTests" description="directory of classes for junit execution" />
<attribute name="classFilterInclude" default="**/*" description="class filter for include" />
<attribute name="classFilterExclude" default="**/*$*class" description="class filter for exclude" />
<sequential>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/jacocoant.jar"/>
</taskdef>
<jacoco:instrument destdir="${result.classes.instr.dir}/${SELECTED_TEST_CLASS_DIRECTORY}">
<fileset dir="${SELECTED_TEST_CLASS_DIRECTORY}">
<filename regex=".class"/>
</fileset>
</jacoco:instrument>
<path id="classpath">
<pathelement location="lib/junit-4.12.jar" />
<pathelement location="lib/hamcrest-core-1.3.jar" />
<pathelement location="lib/ant-junit4.jar"/>
<pathelement location="./${SELECTED_TEST_CLASS_DIRECTORY}/build/manual/classes"/>
<fileset dir="./lib">
<include name="**/*.jar" />
</fileset>
</path>
<property name="junitReports" value="target/reports"/>
<mkdir dir="${junitReports}"/>
<echo message="hello"/>
<delete dir="./target/reports"/>
<delete dir="./target/site/jacoco"/>
<mkdir dir="./target/reports"/>
<mkdir dir="./target/site/jacoco"/>
<jacoco:coverage destfile="${result.exec.file}">
<junit haltonfailure="false" showoutput="true" printsummary="yes" fork="true" forkmode="once">
<formatter type="xml"/>
<classpath refid="classpath"/>
<classpath refid="defaultTESTpath"/>
<classpath location="./ServerTests/build/manual/classes"/>
<test name="com.hp.ssmc.pianoui.RemoteCopy.VerifyTest" todir="${testreport.dir}"/>
</junit>
</jacoco:coverage>
<junitreport todir="${testreport.dir}">
<fileset dir="${testreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${testreport.dir}"/>
</junitreport>
<jacoco:report>
<executiondata>
<fileset file="${result.exec.file}" />
</executiondata>
<structure name="com.hp.ssmc.pianoui.RemoteCopy.VerifyTest">
<classfiles>
<fileset dir="${SELECTED_TEST_CLASS_DIRECTORY}/build/manual/classes">
<include name="**/*.class"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="./ServerTests/manual">
<include name="**/*.java"/>
</fileset>
</sourcefiles>
</structure>
<html destdir="${result.report.dir}/report.html"/>
<csv destfile="${result.report.dir}/report.csv"/>
<xml destfile="${result.report.dir}/report.xml"/>
</jacoco:report>
</sequential>
</macrodef>