Java + Gradle + multi-module: Sonarqube does not report full Jacoco coverage

We use SonarQube v2025.1.3 (enterprise edition).

Our projects are multi-module-java-projects. We use Gradle as build tool.
(Integration-)Tests in one module sometimes also cover classes in other modules too.
We generated aggregated code-coverage-data. But SonarQube fails do pick this up.

This issue is similar to Sonarqube does not report full Jacoco coverage from to years ago which is based on older Gradle- und SonarQube-versions.

We created a sandbox-project for this issue and published it: GitHub - christophs78/sonarMultimoduleCoverage

Module “core” contains “ClassA” and “ClassB”.
Module “rest” contains “ClassC”.

Tests for “ClassA” are located in module “core”.
(Integration-)Tests for “ClassB” und “ClassC” are located in module “rest”.

Module “rest” generated the aggregated coverage-report. (rest\build\reports\jacoco\testCodeCoverageReport\html\index.html) All three classes have 100% coverage.

SonarQube only shows 66% coverage because it does not pick up coverage-data for “ClassB”.

We played around with sonar.coverage.jacoco.xmlReportPaths without improving the situation yet.

Hey there.

I do not understand this issue as much as I’d like to, but I was able to get 100% coverage in your example by adding this config (using the subprojects block, and backing up one directory from each module when pointing to the JaCoCo reports)

subprojects {
	sonar {
		properties {
			property "sonar.coverage.jacoco.xmlReportPaths", "../**/testCodeCoverageReport.xml" // the one aggregated coverage file
		}
	}
}