First time to use sonarCloud analyzing the maven project,but it cannot work because of not authorized

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar (default-cli) on project maven-project: Not authorized. Please check the properties sonar.login and sonar.password. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

my command is
mvn sonar:sonar -Dsonar.projectKey=xuejiangtao_maven-project -Dsonar.organization=xuejiangtao-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=xuejiangtao

can someone help me ?

Hi,

I suggest you to use the nice wizard “Create new project”

It will guide you to successfully run your first analysis


i use the ‘creat new project’ and follow the command:sweat: but it shows not authority

Hi.

In the first step (“Provide a token”) select “Generate a token”, give a name for it and click in the button “Generate”.

Then go to the second step and follow the instructions.

1 Like

thats what i do in first step:tired_face: it still cant work, should i config the maven’s setting.xml?

Ok, long answer then.

This is the image that you send:

Do you see this sonar.login property? It shouldn’t be your SonarQube user. That’s your problem.

This is what I get following the instructions:

  • I gave a name to the token:
    image

  • I clicked “Generate”:
    image

  • Then “Continue” and opened the instructions for Maven projects:

Do you see that the sonar.login property is very different than yours?

Just for comparison, this is what happens when I use the “Use existing token” option.

image
image

I think you used this option before. This won’t work, because the token is not valid (btw, suggestion to SonarSource: can’t you validate this? Like, validating the length or something?)

2 Likes

hi, Scott.
Many thanks to you. I found it works if using the token like 8394XXXX!!