Unauthorized Exception on first SonarQube analysis

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:
 -Dsonar.projectKey=my_own_project_key
  • Or inside your build.gradle file:
sonarqube {
    properties {
        property 'sonar.projectKey', 'my_own_project_key'
    }
}