sonarqubesonarqube-scansonar-runner

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar on project demo: You're not authorized to run analysis


Can anyone help me in getting solution for the below error.

Below are the version of the components to configure.

SonarQube Version 9.6.1

Execution command

stage('SonarQube') {
    container ('maven') {
        sh 'mvn -U verify sonar:sonar -Dsonar.host.url=http://serverId:9000  -Dsonar.login=mySonarqubeGlobalToken'
        sh 'mvn -U clean org.jacoco:jacoco-maven-plugin:prepare-agent package org.jacoco:jacoco-maven-plugin:report'
    }
}

In My pom.xml

<plugins>
    <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.9.1.2184</version>
    </plugin>
</plugins>

In Console Window I am getting error

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project demo: You're not authorized to run analysis. Please contact the project administrator. -> [Help 1]

Solution

  • It worked after I took User token from Sonarqube –

    [Edited] Don't use the project token generated in the Project Overview page. Use the "User Token" generated from your account profile instead.

    My Account > Security > Generate Tokens > Select "User Token" > Click "Generate