# JaCoCo aggregate report for multi-module Maven and Gradle builds
> Set up a JaCoCo aggregate report across modules with Maven report-aggregate or Gradle jacoco-report-aggregation, and why the aggregate report is empty.
Web page: https://supercov.com/blog/jacoco-aggregate-report · Published 2026-11-27
All Supercov pages for agents: https://supercov.com/llms.txt · Full text: https://supercov.com/llms-full.txt
Eight setups on a two-module project with JaCoCo 0.8.16, Maven and Gradle: which one reports code covered from another module.
A JaCoCo report per module counts only that module's own tests. To see code in
one module covered by tests in another, add a separate module that depends on
all the others and runs `report-aggregate` in Maven, or apply
`jacoco-report-aggregation` in Gradle. An aggregate goal in the parent pom
writes an empty report.

*Per-module reports read one exec file; the aggregate reads every dependency's.*
## Aggregate report setups at a glance
| Setup | What the report showed |
| --- | --- |
| Per-module `report` only | `Pricing` 1 of 8 lines, though `api`'s tests ran 6 |
| Maven: `coverage` module with `report-aggregate`, depends on every module | `Pricing` 6/8, `Checkout` 1/2 |
| Maven: `coverage` module missing the `api` dependency | `Pricing` 1/8; `api` left out |
| Maven: `report-aggregate` in the parent pom | Empty report |
| Maven: `mvn test` instead of `mvn verify` | No aggregate report |
| Gradle: `jacoco-report-aggregation` in a `coverage` project with a `JacocoCoverageReport` registered | `Pricing` 6/8, `Checkout` 1/2 |
| Gradle: the same without the `reporting` block | `Task 'testCodeCoverageReport' not found` |
| Gradle: plugin applied in `api` itself | `Pricing` 6/8, `Checkout` 1/2 |
We ran every setup with JaCoCo 0.8.16, Maven 3.9.16 and Gradle 9.7.1 on JDK
26. The project has two modules: `core` holds `shop.core.Pricing` with one
test for its `format` method, and `api` holds `Checkout`, whose two tests call
`Pricing.total` through `Checkout.quote`.
## Why the per-module report misses lines
```xml
prepare-agent
reporttestreport
```
With these executions in the parent pom, each module writes
`target/site/jacoco`. `core`'s report showed `Pricing` at 1 of 8 lines: only
`format`. The `api` tests did run `total`, and their `jacoco.exec` recorded
it, but that file sits in `api/target`, and `api`'s own report covers only
`api`'s classes.
## Maven: a separate module for report-aggregate
```xml
…shop-parent…
coverage
pom
shopcore1.0.0
shopapi1.0.0
org.jacoco
jacoco-maven-plugin
aggregateverify
report-aggregate
```
Add `coverage` to the parent and run `mvn verify`. The
report lands in `coverage/target/site/jacoco-aggregate`, with `Pricing` at 6
of 8 lines and `Checkout` at 1 of 2. `report-aggregate` reads the execution
data and classes of the module's dependencies, so every module has to be a
dependency; with `core` alone, `Pricing` dropped back to 1/8 and `Checkout`
was gone.

*What each JaCoCo report contained, measured with JaCoCo 0.8.16.*
## Why the Maven aggregate report is empty
| What we tried | What happened |
| --- | --- |
| `report-aggregate` in the parent pom | `target/site/jacoco-aggregate` with no classes |
| The same execution, inherited by `api` | `Pricing` 6/8, but no `Checkout` |
| `mvn test` | No aggregate report: it is bound to `verify` |
| `coverage` without the `api` dependency | `api`'s tests and classes left out |
The parent builds before its modules and depends on none of them, so its
aggregate report had nothing to read. The goal also leaves out the module it
runs in: inherited by `api`, it reported `core`'s `Pricing` and not `api`'s
own `Checkout`. A module of its own avoids both.
## Gradle: jacoco-report-aggregation
```kotlin
// coverage/build.gradle.kts
plugins {
base
`jacoco-report-aggregation`
}
repositories { mavenCentral() }
dependencies {
jacocoAggregation(project(":core"))
jacocoAggregation(project(":api"))
}
reporting {
reports {
register("testCodeCoverageReport") {
testSuiteName = "test"
}
}
}
```
`gradle testCodeCoverageReport` ran both projects' tests and wrote
`coverage/build/reports/jacoco/testCodeCoverageReport` with `Pricing` 6/8 and
`Checkout` 1/2. Without the `reporting` block the task does not exist, and
Gradle stops with "Task 'testCodeCoverageReport' not found". Listing only
`:api` was enough here, because `api` depends on `core`; listing only `:core`
left `api`'s tests out.
In a project that already applies `java`, the plugin registers the task by
itself. Applied in `api`, `gradle testCodeCoverageReport` aggregated `api`
and `core` with no `reporting` block. `gradle test` alone writes no
aggregate report.
## What Supercov adds
```sh
npx supercov -- mvn test
npx supercov runs latest gaps
```
Supercov measured both modules in one run, with no aggregation module: the 3
tests across `core` and `api`, `Pricing.total` covered by the `api` tests, and
one line left, the `throw` for a quantity of zero. It also showed that
`member && sum >= 10_000` was never run with `member` false, an MC/DC gap the
line counts hide. See [JaCoCo report not
generated](https://supercov.com/blog/jacoco-report-not-generated.md) when there is no report at all,
and [Java code coverage tools](https://supercov.com/compare/java-code-coverage.md) for the
alternatives.