which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
sonarqube - 10.4.1.88267
Maven - 3.9.5
Java - corretto-17.0.9
how is SonarQube deployed: zip, Docker, Helm
Via zip. Running on localhost:9000
what are you trying to achieve
I am trying to run the analysis using the command mvn clean verify sonar:sonar -Dsonar.projectKey=<project_key> -Dsonar.projectName='<project_name>' -Dsonar.token=<token>
what have you tried so far to achieve this
I have tried putting the plugin in the settings.xml for maven as following the documentation from this link: SonarQube Scanner Documentation for Maven. This is as follows:
I have also tried not including the top in settings.xml as well.
I have also tried the other commands as shown in the documentation.
I have not used jacoco.
The Debugged log is here: debug-log.txt (95.5 KB) Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
Any help would be appreciated thanks!
Have you tried generating a new token? Have you verified that the account your token is generated from has analysis permissions on the project? Are you sure the token has analysis permissions on a project? It’s possible to generated a project-specific token, and if you try to use it on a different project it won’t work.
I have tried generating a new token (both project and global).
I myself am logging in as the admin with administrator privileges and analysis permissions.
As far as I know, if my account has admin privileges, then the token using it so should be the same.
I am using the project token and a global token as well and the same error comes up (both being under the admin user).
However, the same error is coming.
I should clarify further, I am using the embedded database to test now (H2) and have not configured any external databases. I have not touched the sonar.properties file either.
Furthermore, I would like to display the log here as well:
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar:3.11.0.3922:sonar (default-cli) @ rabbit_api ---
[INFO] 10:15:43.468 Java 17.0.9 Amazon.com Inc. (64-bit)
[INFO] 10:15:43.468 Windows 11 10.0 (amd64)
[INFO] 10:15:43.661 User cache: C:\Users\User-12\.sonar\cache
[INFO] 10:15:43.751 Communicating with SonarQube Server 10.4.1.88267
[INFO] 10:15:43.800 Default locale: "en_HK", source code encoding: "UTF-8"
[INFO] 10:15:44.519 Load global settings
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping rabbit_api
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.620 s
[INFO] Finished at: 2024-03-20T10:15:44+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar (default-cli) on project rabbit_api: Not authorized. Analyzing this project requires authentication. Please check the user token in the property 'sonar.token' or the credentials in 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
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar:3.11.0.3922:sonar (default-cli) @ rabbit_api ---
[INFO] 15:41:08.608 Java 17.0.9 Amazon.com Inc. (64-bit)
[INFO] 15:41:08.608 Windows 11 10.0 (amd64)
[INFO] 15:41:08.828 User cache: C:\Users\User-12\.sonar\cache
[INFO] 15:41:09.103 Communicating with SonarQube Server 10.4.1.88267
[INFO] 15:41:09.125 Default locale: "en_HK", source code encoding: "UTF-8"
[INFO] 15:41:09.776 Load global settings
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping rabbit_api
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.836 s
[INFO] Finished at: 2024-03-22T15:41:09+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar (default-cli) on project rabbit_api: Not authorized. Analyzing this project requires authentication. Please check the user token in the property 'sonar.token' or the credentials in 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
Your initial post talked about trying different ways to pass the token. How are you doing it now? Can you generate a fresh token (so we know it’s not corrupted) and try passing it on the analysis command line, please?