Sonarqube not showing code coverage

SonarQube version:7.4.0
sonar-maven plugin:
Jacoco version: 0.8.2 / 0.8.4

we have configured jacoco plugin and integrated with Jenkins, so on build code coverage should reflect in sonarqube.

But i see Jenkins workspace i can see reports are generated showing code coverage but it doesnt reflect in Sonarqube.

I am very new to this topic and i need some help.

I went through many topic in this forum but wasnt able to get solved.

Sonar config in Jenkins

junit '**/target/surefire-reports/TEST-*.xml'
stash includes: 'target/**/*, src/main/java/**/*.java, pom.xml, src/main/resources/*/**, *.sh, appspec.yml, deploy/*, *.zip, public/**/*', name: 'build'
slackSend (color: '#00FF00', message: "BUILT: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")

    unstash 'build'
     sonar '-Dsonar.sources=src/main/java \
                    -Dsonar.exclusions=**/test/**/*.java \
                    -Dsonar.jacoco.reportPath=target/jacoco.exec \
                    -Dsonar.jacoco.itReportPath=target/jacoco-it.exec \
                    -Dsonar.dynamicAnalysis=reuseReports \


Welcome to the community!

You appear to build with Maven(?). So it’s not clear to me why you feel the need to explicitly set things like the path to your source files and to your test reports; a Maven analysis should pick those up automatically. It should also automatically recognize the difference between source and test files and treat them accordingly. I guess that’s what you’re trying to accomplish by excluding tests…? But that may actually be the source of your problem. Anyway, I would start by dropping that exclusion.


Thanks for looking and sorry for replying late. But the issue was with some build path and that was not identifying / in /target/jacoco.exec.

as a workaround we have removed the / and sonar code coverage works now, but we are working with developer to look into this.

will mark this issue close.

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