Problem to invoke SonarQube trough a Jenkins pipeline

Hello everyone!
I am trying to use a pipeline job in Jenkins (version 2.263.1) able to create a sonarQube report (Sonar version is 7.9.5). This is for a Python application whose code is in Subversion 1.6.11. I mention this because most of examples I have found use Maven, Gradle or Git. I have tried to adapt these examples to my circumstances but I am not able to make it work…

The current code I have in my pipeline is:
pipeline {
agent any

stages {
    stage('Hello') {
        steps {
            echo 'Hello World'
            echo 'Adiós'
            checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'Jenkins_user', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'https://svn.oepm.local/DEVOPS/Jurisprudencia_Python']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])

	stage('SonarQube analysis') {
				def scannerHome = tool 'SonarRunner_3.3.0';
			withSonarQubeEnv('My SonarQube Server') {
					sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=Jurisprudencia_ORCTXT -Dsonar.sources=. -Dsonar.login=69d977f11910740d9ca95b75cede210db01489c9"


The error message is:
ERROR: SonarQube installation defined in this job (My SonarQube Server) does not match any configured installation. Number of installations that can be configured: 1.
If you want to reassign jobs to a different SonarQube installation, check the documentation under SonarScanner for Jenkins | SonarQube Docs

Of couse, I have already checked that link, but it didn’t help me.
I have taken a look to my configuration and this is what I see:

As it can be seen, the reference “SonarRunner_3.3.0” is defined in my Jenkins configuration so I don’t understand what the error message means.
I have also checked that a project with that key exists in sonarQube, so is not the problem.

Any idea or suggestion? What am I doing wrong?

Thanks in advance.


is not related to the Sonar Scanner but to
withSonarQubeEnv('My SonarQube Server') { .. }

According to the screenshot of your Jenkins config it has to be
withSonarQubeEnv('SonarQube_OEPM') { .. }


1 Like

You are right Gilbert, thanks!

I though that was a free text like the one in stages(""), but no.

Now, the error I obtain is a different one:
groovy.lang.MissingPropertyException: No such property: scannerHome for class: groovy.lang.Binding

It is related to the use of the scannerHome variable. I am doing some tests in order to solve it.


i think its because of using def scannerHome which means it’s bound to the
scope of script { ... } try without def, also you need no ‘;’ with groovy :slight_smile:

script {
  scannerHome = tool 'SonarRunner_3.3.0'

Here it’s the same as withSonarQubeEnv, ‘SonarRunner_3.3.0’ must match your jenkins configuration.

1 Like

I will try. Thank you!