SonarQube Authentication Error

versions using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube Version: 7.9.1
Sonar Maven Plugin version: 3.4.0.905
Maven version: 3.5.3
java version: 1.8
Windows10 OS

I am Trying to create analysis report by running “mvn install sonar:sonar”

I started configuring my project using the information from


configure my settings.xml as provided in the above link, along with host -url I also passed sonar-login and sonar-password in the settings.xml.
configured my plugin like below


org.sonarsource.scanner.maven
sonar-maven-plugin
3.4.0.905


initialize

sonar





after configuration i ran my command “mvn install sonar:sonar” ended up with

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project RARMongoService: Not authorized. Analyzing this project requires to be authenticated. Please provide the val
ues of the properties sonar.login and sonar.password.

looking on to the error i did pass properties sonar.login and sonar.password in settings.xml

Hi,

Welcome to the community!

There are a couple things going on here. First, you should prefer a token for analysis rather than login/password. You can generate one via the UI. Click on your avatar at the top-right -> My Account -> Security.

Second, rather than setting credentials in settings.xml, the analysis command line would be better (altho settings.xml ought to work).

And third, you can add -Dsonar.scanner.dumpToFile=[path to file] to see what key/value pairs analysis is actually getting.

 
HTH,
Ann