SLING-8262 - Add SonarQube analysis to Jenkins jobs
Wrap Maven execution in a `withMaven` block, similar to
the one for the 'SonarQube' stage. Otherwise the build fails
due to not finding the `mvn` executable.
diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 67db6f5..76e5499 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -74,8 +74,11 @@
}
// Alls params are set, let's execute using #withCrendentials to hide and mask Robert's token
withCredentials([string(credentialsId: 'sonarcloud-token-rombert', variable: 'SONAR_TOKEN')]) {
- def mvnCmd = "mvn -U clean verify sonar:sonar ${sonarcloudParams}"
- sh mvnCmd
+ withMaven(maven: globalConfig.mvnVersion,
+ jdk: jenkinsJdkLabel(jobConfig.jdks[0], globalConfig),
+ publisherStrategy: 'EXPLICIT') {
+ sh "mvn -U clean verify sonar:sonar ${sonarcloudParams}"
+ }
}
}
}