SonarQube in Jenkins Pipeline

I’m trying to use the SonarQube plugin in Jenkins and I’m not getting something quite right.

I’m using Jenkins 2.121.2 on OpenSUSE.

I’ve installed “SonarQube Scanner for Jenkins” version 2.8.

Under “Manage Jenkins”, “Configure System”, in the section labelled “SonarQube Servers”, I’ve created a SonarQube:
Name: My SonarQube Server
Server authentication token:

I’ve used this configuration in Maven, so I’m pretty sure it’s OK.

My pipeline code is:

  stage('SonarQube Analysis') { 
     steps {
       echo 'Running SonarQube Analysis...'
       script {
         def scannerHome=tool 'SonarQube Scanner'
         withSonarQubeEnv('My SonarQube Server') {
           sh "${scannerHome}/bin/sonar-scanner"

The build output is:

ERROR: No tool named SonarQube Scanner found.

Is there some component that I need installed on the Jenkins server besides the SonarQube plugin? The scanner’s on a remote server and it is up and running.

I’d appreciate any ideas.

I did get a little further on this by going into Jenkins | Global Tool Configuration and then adding Sonar Scanner. It wasn’t obvious I needed 3 components (Server, Plugin, Tool).