Steve Kennedy
Steve Kennedy

Reputation: 5402

No tool named SonarQube Scanner 2.8 found error

I followed these instructions to download the SonarQube Scanner plugin for Jenkins. I've configured these jenkins global settings for the SonarQube scanner correctly. The SonarQube server is setup and functioning properly.

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins#AnalyzingwithSonarQubeScannerforJenkins-AnalyzinginaJenkinspipeline

But when the build runs, it produces this error: No tool named SonarQube Scanner 2.8 found.

enter image description here

I am using a Jenkins declarative pipeline script for pipeline build.

I am using Jenkins ver. 2.131. I am using "SonarQube Scanner for Jenkins" Plugin version 2.8.1. I believe the Jenkins server is a common linux flavor. I am NOT using any version of Maven, and don't require it to build my projects.

I figured the plugin installed the actual scanner files for me on Jenkins. Do I need to have some version of the scanner command files installed, beyond whatever the plugin provided me? Meaning, is there something other than the plugin that I need to install on by Jenkins server? I would hope the SonarQube plugin would give me everything I would need to run on Jenkins build.

Here's the relavent part of my script:

 stages {
   stage("SonarQube Analysis") {
      agent any
      steps {
        script {
            def scannerHome = tool 'SonarQube Scanner 2.8';
            withSonarQubeEnv("foo") {
              sh "${scannerHome}/bin/sonar-scanner"
            }
        }
      }
    }

Here is a screenshot of the global configuration:

enter image description here

Upvotes: 2

Views: 11927

Answers (2)

Anton
Anton

Reputation: 730

May be would be actual for maven's users

stage("SonarQube analysis") {
        steps {
            script {
                def scannerHome = tool 'SonarQube Scanner';
                withSonarQubeEnv('SonarQube Server') {
                    sh 'mvn clean package sonar:sonar'
                }
            }
        }
    }

Upvotes: 0

agabrys
agabrys

Reputation: 9136

I think you didn't add Scanner in Jenkins Global Tool Configuration. You can do it by doing the following steps:

  • click Manage Jenkins
  • choose Global Tool Configuration
  • scroll to SonarQube Scanner
  • add SonarQube Scanner 2.8

SonarQube Scanner 2.8 configuration

Upvotes: 4

Related Questions