I have a pipeline in jenkins with maven 3.0.2, that I want to update the version of sonarqube from 6.7 to 8.9. When trying to use the "when" condition in Jenkins (first time I try), I get an error No such DSL method 'when' found among steps. According to lei, some maven plugin is missing, I already tried some but it still doesn't work. Any ideas?
container ("standard") {
try {
stage('mySq') {
when { not {changeRequest()} }
steps {
withSonarQubeEnv(installationName: 'mySqinst', credentialsId: 'myCred')
{ withMaven(maven: env.MAVEN_VERSION, jdk: 'OpenJDK-Latest-JDK11',
globalMavenSettingsConfig: env.MAVEN_GLOBAL_CONFIG) {
//s
sh '''
mvn -Dsonar.login=${SONAR_AUTH_TOKEN} \
-Dsonar.branch.name=${BRANCH_NAME} \
${SONAR_MAVEN_GOAL}
'''
}
}
}
}catch {exception e}