Sonarcloud: not authorized on Travis

Hi,

I’m trying to execute SonarCloud through travis for the Spring Petclinic organization.
I’ve started with the spring-framework-petclinic project: https://github.com/spring-petclinic/spring-framework-petclinic
From my laptop, with the maven command I’ve runned a first analyze: https://sonarcloud.io/dashboard?id=spring-petclinic_spring-framework-petclinic

But from TravisCI, it fails every time, it says: "You’re not authorized to run analysis. Please contact the project administrator.”.
Here is my travis configuration: https://github.com/spring-petclinic/spring-framework-petclinic/blob/master/.travis.yml
I’ve tried to encrypt the SonarCloud token with and without the -r option :

travis encrypt “sonarcloud_token”
travis encrypt -r spring-petclinic/spring-framework-petclinic “sonarcloud_token”

Thank you very much for your help

Hi Antoine,

Looking at the TravisCI add-on documentation, looks like there is something missing in the “SonarQube Scanner for Maven” documentation: you need to specify the sonar.projectKey property (in your POM or in the command line execution) and set it to spring-petclinic_spring-framework-petclinic in your case. Otherwise, Maven infers the project key from the groupId and the artifactId - which does not exist in your org.

I will ask for update on the TravisCI doc.

Hope this helps!

1 Like

For further reference, here’s the PR on Travis Doc side to update the doc: https://github.com/travis-ci/docs-travis-ci-com/pull/2358

Thanks a lot Fabrice. I’ve added the sonar.projectKey property and my Travis build is now working.

2 Likes