At the moment we try to add SonarQube analyzing to our jenkins job pipeline. But every time the build job failed with the message: "java.lang.NoSuchMethodError: **No such DSL method withSonarQubeEnv".
We have reinstall all plugins and configurations. Nothing help.
So maybe someone of you can help us.
What we have done:
Do all steps of this tutorial from sonarqube: Analyzing with SonarQube Scanner for Jenkins
- Install SonarQube Plugin 2.5
- Add and configure SonarQube under Manage Jenkins > Configure System
- Add SonarQube Scanner under Manage Jenkins > Global Tool Configuration
Add this code after the checkout of our project to the groovy file for the pipeline:
stage('SonarQube analysis') // requires SonarQube Scanner 2.8+ def scannerHome = tool 'SonarQube Scanner 2.8'; withSonarQubeEnv('SonarQube 5.6.4') { sh "${scannerHome}/bin/sonar-scanner" }
Current Versions of our tools
Our Jenkins has the version 2.2
Our SonarQube Server has the version 5.6.4
The SonarQube Server run fine. We can analyzing our code over a local scanner.