We are having issues on the Sonarqube Stage in Jenkins Pipeline.
We are Getting this error below.
[Sonarqube] > Not authorized. Please check the user token in the property ‘sonar.token’ or the credentials in the properties ‘sonar.login’ and ‘sonar.password’.
Here is our code below
--- this code is working using sonar.login
export SONAR_TOKEN="Our sonar token"/apps/installers/gradle-8.5/bin/gradle sonar -Dsonar.login=$SONAR_TOKEN --stacktraceecho "Execution of Sonarqube is done"
--- but after changing it to sonar.token we are getting Not Authorized issue.
export SONAR_TOKEN="Our sonar token"/apps/installers/gradle-8.5/bin/gradle sonar -Dsonar.token=$SONAR_TOKEN --stacktraceecho "Execution of Sonarqube is done"
First of all, you really should upgrade from v10.1 to v10.6. v10.1 is an EOL version of SonarQube. However, that version should perfectly support sonar.token.
Are you sure that sonar.login isn’t specified somewhere else? I’m thinking of a build.gradle file or something similar. Having multiple values set (sonar.login and sonar.token) can cause issues.
Just to confirm, sonar.login works fine for the v10.1 version?