Code coverage report from jacoco.exec file using ant -


i trying generate code coverage report jacoco.exec file using ant.

my ant build is:

<?xml version="1.0"?> <project xmlns:jacoco="antlib:org.jacoco.ant" name="example ant build jacoco" default="rebuild">    <description> example ant build file demonstrates how jacoco coverage report can itegrated existing build in 3 simple steps. </description>    <property name="src.dir" location="./java"/>   <property name="result.dir" location="./target"/>   <property name="result.classes.dir" location="./classes"/>   <property name="result.report.dir" location="${result.dir}/site/jacoco"/>   <property name="result.exec.file" location="./jacoco.exec"/>    <!--  step 1: import jacoco ant tasks  -->   <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">     <classpath path="./jacocoant.jar"/>   </taskdef>    <target name="compile">     <mkdir dir="${result.classes.dir}"/>     <javac srcdir="${src.dir}" destdir="${result.classes.dir}" debug="true" includeantruntime="false"/>   </target>    <target name="test" depends="compile">     <!--  step 2: wrap test execution jacoco coverage task  -->     <jacoco:coverage destfile="${result.exec.file}">       <java classname="org.jacoco.examples.parser.main" fork="true">         <classpath path="${result.classes.dir}"/>         <arg value="2 * 3 + 4"/>         <arg value="2 + 3 * 4"/>         <arg value="(2 + 3) * 4"/>         <arg value="2 * 2 * 2 * 2"/>         <arg value="1 + 2 + 3 + 4"/>         <arg value="2 * 3 + 2 * 5"/>       </java>     </jacoco:coverage>   </target>    <target name="report" depends="test">     <!--  step 3: create coverage report  -->     <jacoco:report>       <!--  task needs collected execution data , ...  -->       <executiondata>         <file file="${result.exec.file}"/>       </executiondata>       <!--  class files , optional source files ...  -->       <structure name="jacoco ant example">         <classfiles>           <fileset dir="${result.classes.dir}"/>         </classfiles>         <sourcefiles encoding="utf-8">           <fileset dir="${src.dir}"/>         </sourcefiles>       </structure>       <!--  produce reports in different formats.  -->       <html destdir="${result.report.dir}"/>       <csv destfile="${result.report.dir}/report.csv"/>       <xml destfile="${result.report.dir}/report.xml"/>     </jacoco:report>   </target>    <target name="rebuild" depends="compile,test,report"/>  </project> 

but while compiling ant build errors related undefined symbols in code. how remove them?

an example of error is:

compile: [javac] compiling 13 source files c:\documents , settings\user\desktop\jacoco\classes [javac] c:\documents , settings\user\desktop\jacoco\java\file.java:13: error: package org.abc.def.ghi.primitives not exist [javac] import org.abc.def.ghi.primitives.request; 

these imports code , internally defined ant doesn't recognize them. have copied .java , .class files.

any pointers appreciated.

this not code coverage problem. code failing @ compile step. it's javac command throwing error.you need solve problem first.

i don't understand mean by:

.... have copied .java , .class files.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -