Analyzed bundle 'Sample Bundle' with 0 classes

1,413 views
Skip to first unread message

sujit...@gmail.com

unread,
Aug 26, 2015, 4:23:12 AM8/26/15
to JaCoCo and EclEmma Users
Hi all,

I have configured jacoco plugin as follows. And my project structure as below. There is a parent pom and two modules as core and tests. core contains all the source files. tests contains the test cases.

parent --> core
--> tests

I can see that, jacoco.exec file contain some data. Any idea whats went wrong here?.. Is this because source is in another module?.


<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!--<dataFile>target/jacoco.exec</dataFile>-->

<includes>
<include>org.sample*</include>
</includes>
</configuration>
</execution>
<execution>
<configuration>
<includes>
<include>org.sample*</include>
</includes>
<dataFile>target/jacoco.exec</dataFile>
</configuration>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>

Regards,
Aruna

sujit...@gmail.com

unread,
Aug 26, 2015, 5:29:57 AM8/26/15
to JaCoCo and EclEmma Users, sujit...@gmail.com

By the way my test cases are running in a pax-exam container. Is this an issue?.

Evgeny Mandrikov

unread,
Aug 28, 2015, 5:54:37 AM8/28/15
to JaCoCo and EclEmma Users, sujit...@gmail.com
Hi Aruna,

I guess that this is related to the fact that tests and main code are located in different modules. We have an open ticket for such case - https://github.com/jacoco/jacoco/pull/217 . As a workaround you can use Ant Task - this is what actually is done in build of JaCoCo see ( https://github.com/jacoco/jacoco/blob/master/org.jacoco.doc/pom.xml#L89 ).

Best regards

sujit...@gmail.com

unread,
Aug 28, 2015, 7:05:23 AM8/28/15
to JaCoCo and EclEmma Users, sujit...@gmail.com
Hi Evgeny,

Yeah, That was the case. I solved the problem using the ant task approach.

Following is the plugin details. I am putting for future reference.

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.maven.antrunplugin}</version>
<executions>
<execution>
<phase>prepare-package</phase>
<configuration>
<target xmlns:jacoco="antlib:org.jacoco.ant">
//this task is to provide class/src files locations for jacoco report generation
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${project.build.directory}"/>
</taskdef>
<jacoco:report>
<executiondata>
<file file="${project.build.directory}/jacoco.exec"/>
</executiondata>
<structure name="Sample Tests">
<classfiles>
<fileset dir="../core/target/classes"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="../core/src"/>
</sourcefiles>
</structure>
<html destdir="${project.build.directory}/site/jacoco"/>
</jacoco:report>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>${version.org.jacoco.ant}</version>
</dependency>
</dependencies>
</plugin>

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages