Versions
- SonarQube Server Enterprise Edition v2026.2.1 (121354)
- Plugin version: 7.2.3.7755
- jacoco packaged with gradle 9.4.1
Relevant config:
tasks.register("codeCoverageReport", JacocoReport) {
subprojects { subproject ->
subproject.plugins.withType(JacocoPlugin).configureEach {
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
if (testTask.extensions.getByType(JacocoTaskExtension).isEnabled()) {
sourceSets subproject.sourceSets.main
executionData(testTask)
} else {
logger.warn('Jacoco extension is disabled for test task \'{}\' in project \'{}\'. this test task will be excluded from jacoco report.',testTask.getName(),subproject.getName())
}
}
// To automatically run `test` every time `./gradlew codeCoverageReport` is called,
// you may want to set up a task dependency between them as shown below.
// Note that this requires the `test` tasks to be resolved eagerly (see `forEach`) which
// may have a negative effect on the configuration time of your build.
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach {
rootProject.tasks.codeCoverageReport.dependsOn(it)
}
}
}
reports {
xml.required = true
}
}
And each module has org.sonarqube, jvm-test-suite and jacoco.
What is going wrong:
In our gitlab runners we are running the sonar gradle task. The logging for this tasks is too much for the runner and it cuts of the logging for the rest of the task. The log line that keeps repeating is: “File ‘’ not found in project sources”
What have i tried:
Setting sonar.coverage.jacoco.aggregateXmlReportPaths in each module
Setting sonar.coverage.jacoco.aggregateXmlReportPaths at top level only
Setting sonar.coverage.jacoco.xmlReportPaths in each module
Using the jacoco-report-aggregation plugin alongside these other solutions
I have also found a tmp solution by just piping the output into grep (e.g. | grep -v "File '[^']' not found in project sources"), but this is not really a good solution.
None of these solutions gave the desired result. I do believe it has something to do with the exclusions we use. We are excluding our generated file annotated with Generated. The excluded files seem to be logged as not found in project sources. So my guess is: jacoco generates a report on all files → sonar excludes some files but still finds these files in the coverage → log line output. OR: each module has the full (aggregated) report as their coverage → when sonar scans these modules it reads the coverage, but the sources do not have the files outside the module.