I’m having issues with Sonarcloud, where following the “3 easy steps.” for a first Java Gradle Project analysis ends up with
“You’re not authorized to execute any SonarQube analysis. Please contact your SonarQube administrator.”.
I’ve just created an account (from Github), which is Administrator of its own Organization (& sole member) and used the “Analyze new project” button on the homepage .
I tried both the default existing organization and creating a new one, generated a token, and ran the provided command after adding org.sonarqube to my Gradle plugins
./gradlew sonarqube
-Dsonar.organization=XXX
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.login=XXX
I don’t get what I should do about this issue, as checking my permissions confirmed everything is correctly ticked.
Chances are that the SonarCloud project key inferred from your Gradle configuration is already used by someone else (currently, project keys are uniq across organizations). And the tutorial does not take into account this case.
To fix the problem, you need to specify your own project key:
Either on the command line. You simply need to add:
I have exactly the same problem, but adding a projectKey also did not help.
./gradlew sonarqube \
-Dsonar.organization=rexch \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=<snip> -D sonar.projectKey=blah
...
* What went wrong:
Execution failed for task ':sonarqube'.
> You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.
It’s not the exactly the same problem.
The error message is related to the right associated to your token.
Check that the user have the “Execute Analysis” right and if you don’t provision the project on SonarCloud, he should also have the “Create Projects” right.