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


On 22.01.15 20:07, [email protected] wrote:
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 ! :)


--
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/54C15214.2000909%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to