Hi Marc,
I am able to successfully generate the coverage report for one package/module. But, I am getting error when I am trying it for multiple modules. Below is the sample build.xml file. Can you please help on this or provide the documentation for the ant multi module report generation.
Build.xml (Single module) - Running successfully
<project name="jacoco_rpt_pim" xmlns:jacoco="antlib:org.jacoco.ant">
<property name="platformhome" location="."/>
<property name="src.dir" location="./../custom/bestprice"/>
<property name="result.dir" location="."/>
<property name="result.report.dir" location="${result.dir}/site/jacoco"/>
<property name="result.exec.file" location="${result.dir}/jacoco.exec"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${platformhome}/lib/jacocoant.jar"/>
</taskdef>
<target name="jacocoalltests" description="run jacoco">
<ant dir="${platformhome}" target="unittests" inheritrefs="false">
<property name="testclasses.suppress.junit.tenant" value="true"/>
<property name="standalone.javaoptions" value="-javaagent:${platformhome}/lib/jacocoagent.jar=destfile=jacoco.exec,append=true,excludes=com.google.*:com.sun.*:de.hybris.platform.*" /> </ant>
</target>
<target name="report" depends="jacocoalltests">
<!-- Step 3: Create coverage report -->
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}"/>
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="./../custom/bestprice/bestpricepayments/classes"/>
</classfiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}"/>
<xml destfile="${result.report.dir}/report.xml"/>
</jacoco:report>
</target>
</project>
Build.xml(multi module) - Below both are Failing
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}"/>
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="./../custom/bestprice/bestpricepayments/classes"/>
</classfiles>
<classfiles>
<fileset dir="./../custom/bestprice/bestpricecore/classes"/>
</classfiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}"/>
<xml destfile="${result.report.dir}/report.xml"/>
</jacoco:report>
OR This
<!-- Step 3: Create coverage report -->
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}"/>
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<group name="Core">
<classfiles>
<fileset dir="./../custom/bestprice/bestpricecore/classes"/>
</classfiles>
</group>
<group name="Payment">
<classfiles>
<fileset dir="./../custom/bestprice/bestpricepayments/classes"/>
</classfiles>
</group>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}"/>
<xml destfile="${result.report.dir}/report.xml"/>
</jacoco:report>
Thanks,
Ankit Daruka