I'm not sure if I'm missing something or if this is a bug. I have managed to create an aggregate report of my many modules and it is all working fine. However, I wanted to add a check on this aggregate report to ensure the overall coverage is at a minimum. This is the error that I'm getting:
[INFO] --- jacoco-maven-plugin:0.8.4:check (default-check) @ jacoco-report ---
[INFO] Skipping JaCoCo execution due to missing classes directory:<project_dir>/jacoco-report/target/classes
My project is laid out like so:
Root
|--module1
|--module2
...
|--jacoco-report
Below is a snippet of the jacoco-report/pom.xml:
<properties>
<code.coverage.project.folder>${basedir}/../</code.coverage.project.folder>
<code.coverage.overall.data.folder>${basedir}/../target/</code.coverage.overall.data.folder>
<code.coverage.overall.data.file>${code.coverage.overall.data.folder}/aggregate.exec</code.coverage.overall.data.file>
</properties>
<dependencies>
<dependency>
<groupId>group_name</groupId>
<artifactId>module1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
<execution>
<id>merge-results</id>
<phase>verify</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${code.coverage.project.folder}</directory>
<includes>
<include>**/target/jacoco.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${code.coverage.overall.data.file}</destFile>
</configuration>
</execution>
<execution>
<id>default-check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${code.coverage.overall.data.file}</dataFile>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>50%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Do I need to copy the class files into the jacoco-report/target/classes/ directory? I assumed they would be copied over.
The report is correctly generated and I can click down to see various classes and their coverage.
Thanks for your help!
I think I will file an enhancement issue asking for something like check-aggregate. BUNDLE was the closest choice I could find, but mostly we are concerned with the overall coverage and not specifically per module.
Marc