jacoco report-aggregate with check fails with missing classes directory error

1,172 views
Skip to first unread message

marc...@gmail.com

unread,
Jul 3, 2019, 1:13:02 PM7/3/19
to JaCoCo and EclEmma Users
Hi,

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!

Marc Hoffmann

unread,
Jul 4, 2019, 12:02:37 AM7/4/19
to JaCoCo and EclEmma Users
Hi,

the check goal works on the local project only. Unlike report-aggregate there is no corresponding goal that checks coverage on multiple projects.

But as you check coverage per “BUNDLE” (which is in case of Maven maven modules) you can add the check goal to the individual projects (or their parent pom). This will also give you the advantage that Maven fails on the specific projects which do not meet your criterial.

Regard,
-marc
> --
> 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 jacoco+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/77896053-37e9-4b33-bd4f-883d6039c96d%40googlegroups.com.

marc...@gmail.com

unread,
Jul 4, 2019, 11:06:28 AM7/4/19
to JaCoCo and EclEmma Users
Thanks for the reply Marc!

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

marc...@gmail.com

unread,
Jul 4, 2019, 11:11:57 AM7/4/19
to JaCoCo and EclEmma Users
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages