SonarQube 7.9.3 not showing Gradle project coverage after upgrading from 6.7.7

Hello Everyone,
We are currently using Sonarqube-6.7.7 and both maven, gradle projects show coverage in SonarQube Project dashboard. we are planning to upgrade to 7.9.3 and did the setup in dev environment. Maven projects show the coverage but gradle projects is showing 0.0% coverage. Builds ran fine but showing 0.0% coverage.
Attached are the build.gradle config, jenkins build log for sonarqube task and folder structure for test reports.

gradle-config.txt (1.8 KB)
gradle-build-log.txt (1.9 KB)

Hi,

Welcome to the community!

This line from your log seems relevant:

Cobertura report not found at /cma/jenkins/workspace/SCPC/SNQ/DEV/Infrastructure/Test-SonarQube-Gradle-New/ct1/target/site/cobertura/coverage.xml

 
Ann

Hi Ann, Thank you for the response.
I see the same message even for successful builds for 6.7.7. version.
we are running the same gradle setup for both 6.7.7. and 7.9.3 versions.
we are using Java 8 for gradle builds.
Coverage is showing on 6.7.7 but not for 7.9.3.

Attached are the coverage reports from both instances and build logs.



gradle-build-log.txt (1.9 KB)
gradle-build-log-6.7.7.txt (1.6 KB)

Thanks & Regards,
Vamsi

Hi Vamsi,

Okay, then this is probably about the fact that the JaCoCo .exec format is no longer supported. You’ll need to generate and import XML reports now.

 
HTH,
Ann

Hi Ann, we are not using Jacoco.exec format. we are using XML reports only. please find the sonarqube configuration from build.gradle below.

sonarqube {
properties {
property “sonar.projectName”, rootProject.name
property “sonar.projectDescription”, rootProject.name
property “sonar.projectVersion”, “{archiveVersion}" property "sonar.language", "java" property "sonar.junit.reportsPath", "{buildDir}/reports”
property “sonar.java.coveragePlugin”, “jacoco”
// property “sonar.jacoco.reportPath”, “{buildDir}/jacoco/test.exec" // Note this property has been deprecated, you should use the sonar.coverage.jacoco.xmlReportPaths property below instead property "sonar.coverage.jacoco.xmlReportPaths", "{buildDir}classes/java/test/com/comerica/ws/test/jacocoTestReport.xml”
property “sonar.binaries”, “${buildDir}/classes”
property “sonar.sourceEncoding”, “UTF-8”
property “sonar.host.url”, “XXXXXXX”
property “sonar.exclusions”, “/reports/
property “sonar.dynamicAnalysis”, “reuseReports”
}
}

Let me know for any questions.

Thanks & Regards,
Vamsi

Hi Vamsi,

It looks like you’ll have to get more detailed analysis logs out of Gradle to see what’s going on.

 
Ann

Hi,

Did you find a solution to this?

I’m seeing a very similar problem; running gradle agaisnt SQ 7.9.x because we’re also stuck to Java 8 for now, and I see the report is being uploaded:

2021-01-29T17:28:13.481+0100 [INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor JaCoCo XML Report Importer [jacoco]
2021-01-29T17:28:13.484+0100 [INFO] [org.sonarqube.gradle.SonarQubeTask] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
2021-01-29T17:28:13.485+0100 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] Reading report '/home/<...>/Workspace/cbc/build/reports/jacoco/test/jacocoTestReport.xml'
2021-01-29T17:28:13.503+0100 [INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=21ms

I can check the report and it is correct and contains the info that one would expect. But the sonarqube dashboard contains nothing and claims there is 0% coverage.

Hi Michael, unfortunately I couldn’t find a solution for this issue.

image001.png

image004.jpg

Annoying. Kind of defeats the purpose of the product when a significant aspect of its functionality is not working as it should.

I’m also seeing an amount of technical debt being picked up by detekt in the gradle console but nothing visible in the sonar dashboard - seems pretty weird.