javamavenjunitjacocojacoco-maven-plugin

Jacoco report-aggregate - Include report of aggregate project


I have a multi-module maven project.

parent
   child1
   child2
   child3-report

All child projects have unit tests, and child3 depends on child1 and child2. Following the pom for child3

<plugin>
     <groupId>org.jacoco</groupId>
     <artifactId>jacoco-maven-plugin</artifactId>
     <version>0.8.2</version>
     <executions>
        <execution>
            <id>prepare-agent</id>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>report-aggregate</id>
            <phase>verify</phase>
            <goals>
                <goal>report-aggregate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The jacoco aggregate report generated just include report for child1 and child2, but not for child3. How to fix this?

Don't want to create fourth submodule just for reports.


Solution

  • There are multiple issues raised (https://github.com/jacoco/jacoco/issues/812) on jacoco github repo related to this feature. Having separate module just for reports might be acceptable for few, but better approach would be to fix this with some configurable flag.

    There is also a pending PR (https://github.com/jacoco/jacoco/pull/1007).