Hi All,

I am using ant to invoke Jacoco in my project. The <task def > in my common 
module.xml looks something like Below. This is from the sample on the Jacoco 
site. I am getting the following error. All the jars are present in the 
lib/test folder. 

jar:file:/C:/BRASS/workspace/Java1.7_14.1.x/lib/test/org.jacoco.ant.jar!/org/jacoco/ant/antlib.xml:19:
 taskdef A class needed by class org.jacoco.ant.ReportTask cannot be found: 
org/jacoco/core/analysis/ICoverageVisitor

using the classloader 
AntClassLoader[C:\BRASS\workspace\Java1.7_14.1.x\lib\test\org.jacoco.ant.jar;C:\ant-1.8.2\lib\ant-launcher.jar;C:\ant-1.8.2\lib\ant-antlr.jar;C:\ant-1.8.2\lib\ant-apache-bcel.ja
r;C:\ant-1.8.2\lib\ant-apache-bsf.jar;C:\ant-1.8.2\lib\ant-apache-log4j.jar;C:\ant-1.8.2\lib\ant-apache-oro.jar;C:\ant-1.8.2\lib\ant-apache-regexp.jar;C:\ant-1.8.2\lib\ant-apache-resolver.jar;C:\ant-1
.8.2\lib\ant-apache-xalan2.jar;C:\ant-1.8.2\lib\ant-commons-logging.jar;C:\ant-1.8.2\lib\ant-commons-net.jar;C:\ant-1.8.2\lib\ant-jai.jar;C:\ant-1.8.2\lib\ant-javamail.jar;C:\ant-1.8.2\lib\ant-jdepend
.jar;C:\ant-1.8.2\lib\ant-jmf.jar;C:\ant-1.8.2\lib\ant-jsch.jar;C:\ant-1.8.2\lib\ant-junit.jar;C:\ant-1.8.2\lib\ant-junit4.jar;C:\ant-1.8.2\lib\ant-netrexx.jar;C:\ant-1.8.2\lib\ant-swing.jar;C:\ant-1.
8.2\lib\ant-testutil.jar;C:\ant-1.8.2\lib\ant.jar;C:\Program 
Files\Java\jdk1.6.0_38\lib\tools.jar]

Total time: 1 second



<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
                <classpath path="lib/test/org.jacoco.ant.jar" />
        </taskdef>
        <target name="clean.jacoco">
                <delete dir="${result.dir}" />
        </target>
        <target name="compile.jacoco">
                <mkdir dir="${result.classes.dir}" />
                <javac srcdir="${src.dir}" destdir="${result.classes.dir}" 
debug="true" includeantruntime="false" />
        </target>

        <target name="test.coverage" depends="compile">

                <!-- Step 2: Wrap test execution with the 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>
                        <!-- 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="${result.classes.dir}" />
                                </classfiles>
                                <sourcefiles encoding="UTF-8">
                                        <fileset dir="${src.dir}" />
                                </sourcefiles>
                        </structure>
                        <!-- to 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>

Reagrds,
ABHAY

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to