Coverage report not found at gradle java project


we have a problem about java sonar analisys using gradle. It doesn’t find coverage report.

Sonarqube version:
Developer EditionVersion 8.2 (build 32929)

Gradle sonarqube plugin:
id “org.sonarqube” version "2.6.2"

Java release:
java version "1.8.0_271"
Java™ SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot™ 64-Bit Server VM (build 25.271-b09, mixed mode)

Our gradle properties:

http://sonar-sonarqube-01.kite.lab is an empty sonarqube instance, no project has been analized yet.

We analize executing:
./gradlew clean build jacocoTestReport sonarqube

This produces a coverage report at:

Which was not find by analysis:
Cobertura report not found at /home/emontero/trabajo/smartM2M/pdihub/mc-java-sonar-test/java-test-project/target/site/cobertura/coverage.xml

I note that analysis does not seek at: systemProp.sonar.coverage.jacoco.xmlReportPaths=build/reports/coverage.xml, it goes to default sonarqube server defined path: Myproject->Project settings->Code coverage->Report path: target/site/cobertura/coverage.xml

Trying to solve it, i have saw at sonarqube a coverage property:
Key: sonar.cobertura.reportPath

If i use this at my file:
Instead using → systemProp.sonar.coverage.jacoco.xmlReportPaths=build/reports/coverage.xml
Use → systemProp.sonar.cobertura.reportPath=build/reports/coverage.xml

I’ve got a null pointer exception:

07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':sonarqube'.
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.lang.NullPointerException (no error message)
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.  Run with --scan to get full insights.
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at
07:14:12.916 [WARN] [org.gradle.internal.featurelifecycle.LoggingDeprecatedFeatureHandler] 
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
07:14:12.916 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 4s

I think something is happen with that property because other analisys stuff like bugs, codesmells…are shown at sonarqube server.

I have upload a java test project to: GitHub - rt01145/java-test-project, i have upload all project, including build folders and coverage report in case can help you in any way

Also I have read: sonar.coverage.jacoco.xmlReportPaths not reporting coverage - #6 by dmeneses but dont understand what is “Moving the files to the java-style directory structure seemed to work and coverage was reported.”
I have tried to put coverage report at:

and change path to:

But i have the same problem:
Cobertura report not found at /home/emontero/trabajo/smartM2M/pdihub/mc-java-sonar-test/java-test-project/target/site/cobertura/coverage.xml
I think analylis does not take my gradle defined property because that “/target/” path is only defined at sonar server

Hi Eloy.

I made some modifications to your project:

  • Upgraded jacoco to v0.8.6 and ASM to 8.0.1 (just to be able to use Java 11)
  • Removed the property ‘sonar.jacoco.reportPaths’ in build.gradle - This property is no longer supported. The new property is sonar.coverage.jacoco.xmlReportPaths, which is already defined in
  • Removed all other sonar properties in These properties get automatically generated by the gradle sonarqube plugin based on the project’s configuration. So unless you want to manually override something, they are only required if using the Sonar Scanner CLI.

The coverage is being loaded by SonarQube:

If you run gradle with debug logs enabled (add -d), you should see:

14:33:14.379 [INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor JaCoCo XML Report Importer [jacoco]
14:33:14.387 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] Reading report '[...]\java-test-project\java-test-project\build\reports\coverage.xml'

Hi Duarte,

Thank you for replying so quick.

I’ve make changes you told me:

But it still doesn’t find coverage :frowning:
./gradlew clean build jacocoTestReport sonarqube

> Task :sonarqube
Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using property.
Cobertura report not found at /home/emontero/trabajo/smartM2M/pdihub/java-test-project/java-test-project/target/site/cobertura/coverage.xml

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.

9 actionable tasks: 3 executed, 4 from cache, 2 up-to-date

I have tried to analize using java 11 too, but getting same results.

To test this, i delete my sonarqube project each time, so this is a new project analisys each time. I think that it still takes cobertura report path from server at which default is maven-way path (/target/). Because of our sonarqube server automation we couldn’t change this, this property should came from sonar analisys.

Feel free to make a pull request to github project, maybe i didn’t understand properly what you want to say :frowning:

Could you please post your logs with debug enabled (add -d)?

Hi, executing
./gradlew clean build jacocoTestReport sonarqube -d >> output.txt produces attached file
output.txt (1.2 MB)

SonarQube 8.2 comes with the the plugin ‘sonar-jacoco-plugin-’. I don’t see it in the logs. Did you remove it?

My fault :frowning: , i had been uninstalling it.

Thank you so much.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.