Browse Source

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
Rafael Dominguez 6 years ago
parent
commit
b8a96b1f21
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Jenkinsfile

+ 1 - 1
Jenkinsfile

@@ -30,7 +30,7 @@ try {
 				checkout scm
 				checkout scm
 				withCredentials([string(credentialsId: 'spring-sonar.login', variable: 'SONAR_LOGIN')]) {
 				withCredentials([string(credentialsId: 'spring-sonar.login', variable: 'SONAR_LOGIN')]) {
 					try {
 					try {
-						sh "./gradlew clean sonarqube -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace"
+						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"
 					} catch(Exception e) {
 					} catch(Exception e) {
 						currentBuild.result = 'FAILED: sonar'
 						currentBuild.result = 'FAILED: sonar'
 						throw e
 						throw e