GitLab+Gradle+sonarQube showing code coverage 0% for java

Code coverage is showing 0 in sonar dashboard.

description = 'Project-Name'
version = '1.0'
sonarqube {
    properties {
        property 'sonar.projectName', 'sampleProject'
        property 'sonar.coverage.jacoco.xmlReportPaths', '${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.sonarqube'
apply plugin: 'jacoco'

jacocoTestReport {
  dependsOn test
  reports {
     xml.required = true
     csv.required = false
     html.destination file("${buildDir}/reports/jacoco")
     xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")

I am using Sonarqube 10.2 recently upgraded, gradle8.1, java 17.


Welcome to the community!

Please share your analysis log.

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.