Analyzed bundle '...' with 0 classes

1,529 views
Skip to first unread message

e.gue...@gmail.com

unread,
Jan 22, 2015, 2:07:59 PM1/22/15
to jac...@googlegroups.com
Hi,

I try to generate a code coverage report with Jacoco but it said to me that 0 classes has been instrumented.

I have an integration test project that use another one which contains the applicative code. Both of them inherit a parent pom with only configuration version.

[Integration] ------> [Parent]
| ^
| |
v |
[Business]----------------

My pom is the following one :

*********************************************************************************
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mydomain</groupId>
<artifactId>IntegrationTests</artifactId>
<parent>
<groupId>com.mydomain</groupId>
<artifactId>Parent</artifactId>
<version>Parent-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

<name>Integration Tests</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-report-integration</id>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>

<configuration>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<!--<minimum>0.80</minimum>-->
</limit>
<limit implementation="org.jacoco.report.check.Limit">
<counter>CLASS</counter>
<value>MISSEDCOUNT</value>
<!--<maximum>0</maximum>-->
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.2</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>${argLine} <other args></argLine>
<systemProperties>
<property>
<name>user.language</name>
<value>en</value>
</property>
<property>
<name>user.region</name>
<value>GB</value>
</property>
</systemProperties>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
<configuration combine.self="override">

</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<!-- must be on the classpath -->
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<version>0.7.2.201409121644</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.mydomain</groupId>
<artifactId>Business</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
*********************************************************************************

I ran the verify goal, my integration test are launched, the agent seems to be correctly passed as paremeters.

It says :
Analyzed bundle 'Integration Tests' with 0 classes
All coverage checks have been met.

I have an exec file in the target but nothing more, no report when I use site.

Can you help me about this ?

Thx ! :)

Marc R. Hoffmann

unread,
Jan 22, 2015, 2:40:05 PM1/22/15
to jac...@googlegroups.com
Hi,

currently our JaCoCo Maven plug-in works within single projects only:
The report is created for the classes in Integration (which probably
does not contain any main code at all).

We have a pending feature reuest to support such multi-module
scenarions. A possible work-around is to embed a Ant script which
creates the report based on classes from other modules (JaCoCo build
itself is done this way).

Maybe there are other options with plain Maven, but here we need a Maven
wizard to jump in (Evgeny, Mirko?).

Regards,
-marc

e.gue...@gmail.com

unread,
Jan 23, 2015, 6:32:42 AM1/23/15
to jac...@googlegroups.com
Ok thx for the support ! :)

I you have more info to do the job with the ant script, or better via maven if some workaround are possible.

As I understand the problem is the agent will process only classes from the same project not any dependencies ?

Thx again !

Marc R. Hoffmann

unread,
Jan 23, 2015, 12:19:32 PM1/23/15
to jac...@googlegroups.com
> I you have more info to do the job with the ant script, or better via maven if some workaround are possible.

You might take a look at the JaCoCo build itself: https://github.com/jacoco/jacoco/blob/master/org.jacoco.doc/pom.xml#L76



> As I understand the problem is the agent will process only classes from the same project not any dependencies ?

It's not about the agent. The agent instruments all classes which are
loaded into the JVM. It's about the report goal which needs the set of
classes which should show up in the report.

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