CGarces
(Carlos Garcés)
May 29, 2020, 9:24pm
1
I’m trying to use sonar scanner 4.3 with jenkins 2.222.3
I have configured the plugin and works fine if I call the scanner from one project, but not from one pipeline.
I’m using this:
node {
stage('SonarQube analysis') {
def scannerHome = tool 'SonarQubeScanner';
withSonarQubeEnv('sonar_scanner') { // If you have configured more than one global server connection, you can specify its name
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
but fails wih
ERROR: No tool named SonarScanner found
I have tried also with
def scannerHome = tool 'SonarQubeScanner 4.0';
as see in the documentation
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/
But the error is the same
ERROR: No tool named SonarScanner 4.0 found
Any idea about how use SonarScanner on a pipeline?
ssb2081
(Shailendra)
May 29, 2020, 10:39pm
2
Try adding type: ‘hudson.plugins.sonar.SonarRunnerInstallation’ to your tool definition. So your variable definition looks something like below -
def scannerHome = tool ‘SonarQubeScanner’ type: ‘hudson.plugins.sonar.SonarRunnerInstallation’
1 Like
CGarces
(Carlos Garcés)
May 30, 2020, 11:53am
3
Thanks!
I just note that Jenkins has a Snippet Generator
The generator give me:
tool name: ‘sonar_scanner’, type: ‘hudson.plugins.sonar.SonarRunnerInstallation’
But still failing
ERROR: SonarQube installation defined in this job (sonar_scanner) does not match any configured installation. Number of installations that can be configured: 1.
My current pipeline:
node {
stage('SonarQube analysis') {
def scannerHome = tool name: 'sonar_scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
withSonarQubeEnv('sonar_scanner') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
CGarces
(Carlos Garcés)
May 30, 2020, 12:21pm
4
Hi
I found the error after read this
opened 01:02PM - 22 Sep 18 UTC
closed 09:29AM - 29 Jan 19 UTC
I have setup jenkins in my local machine along with Maven and SonarQube and Sonar Runner. I am able to login...
I was mixing the names between the tool (sonar_scanner) and the server (SonarQube).
Correct pipeline:
node {
stage('SonarQube analysis') {
def scannerHome = tool name: 'sonar_scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
withSonarQubeEnv('SonarQube') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
system
(system)
Closed
June 6, 2020, 12:22pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.