Skip to content

Commit 02d844d

Browse files
raphaelDLjzheaux
authored andcommitted
Enable Code Coverage Reports in Sonar
This commit ensures that jacocoTestReport task is called when running the Sonar stage. Additionally, a variable is passed instructing Sonar where to find the test result data. Fixes: gh-6092
1 parent c0849ba commit 02d844d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
checkout scm
3131
withCredentials([string(credentialsId: 'spring-sonar.login', variable: 'SONAR_LOGIN')]) {
3232
try {
33-
sh "./gradlew clean sonarqube -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace"
33+
sh "./gradlew clean jacocoTestReport sonarqube -Dsonar.jacoco.reportPaths='**/build/jacoco/*.exec' -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace"
3434
} catch(Exception e) {
3535
currentBuild.result = 'FAILED: sonar'
3636
throw e

0 commit comments

Comments
 (0)