This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch bugfix/sonarqube-with-java21 in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git
commit 497f940132b0ab29d50fd0d8dffddaccf08947ef Author: Konrad Windszus <[email protected]> AuthorDate: Wed Jul 22 11:26:21 2026 +0200 Use Java 21 for SonarQube Upgrade sonar-maven-plugin to latest version 5.7.0.6970 Always disable JRE auto-provisioning --- vars/slingOsgiBundleBuild.groovy | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy index 41dbef7..f7d91fb 100644 --- a/vars/slingOsgiBundleBuild.groovy +++ b/vars/slingOsgiBundleBuild.groovy @@ -254,8 +254,9 @@ def analyseWithSonarCloud(def globalConfig, def jobConfig) { def additionalMavenParams = additionalMavenParams(jobConfig) def isPrBuild = env.BRANCH_NAME.startsWith("PR-") + // Always use the JRE from Maven for Sonarqube: https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/scanners/scanner-environment/managing-jre-auto-provisioning#disabling-jre-auto-provisioning // As we don't have the global SonarCloud conf for now, we can't use #withSonarQubeEnv so we need to set the following props manually - def sonarcloudParams="-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_${jobConfig.repoName} -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco-merged/jacoco.xml ${jobConfig.sonarQubeAdditionalParams}" + def sonarcloudParams="-Dsonar.scanner.skipJreProvisioning=true -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_${jobConfig.repoName} -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco-merged/jacoco.xml ${jobConfig.sonarQubeAdditionalParams}" if ( jobConfig.sonarQubeUseAdditionalMavenParams ) { sonarcloudParams="${sonarcloudParams} ${additionalMavenParams}" } @@ -266,15 +267,15 @@ def analyseWithSonarCloud(def globalConfig, def jobConfig) { } else if ( isOnMainBranch() ) { sonarcloudParams="${sonarcloudParams} -Dsonar.branch.name=${BRANCH_NAME}" } - static final String SONAR_PLUGIN_GAV = 'org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184' + static final String SONAR_PLUGIN_GAV = 'org.sonarsource.scanner.maven:sonar-maven-plugin:5.7.0.6970' // 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')]) { - // always build with Java 17 (that is the minimum version supported: https://docs.sonarcloud.io/appendices/scanner-environment/) + // always build with Java 21 (that is the minimum version supported: https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/scanners/scanner-environment/general-requirements) withMaven(maven: globalConfig.mvnVersion, - jdk: jenkinsJdkLabel(17, globalConfig), + jdk: jenkinsJdkLabel(21, globalConfig), publisherStrategy: 'EXPLICIT') { try { - String mvnCommand = "mvn -B -e ${SONAR_PLUGIN_GAV}:sonar ${sonarcloudParams}" + String mvnCommand = "mvn -B -e ${SONAR_PLUGIN_GAV}:sonar ${sonarcloudParams} " if (isUnix()) { sh mvnCommand } else {
