Sonarcloud: not authorized on Travis

(Antoine Rey) #1


I’m trying to execute SonarCloud through travis for the Spring Petclinic organization.
I’ve started with the spring-framework-petclinic project:
From my laptop, with the maven command I’ve runned a first analyze:

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:
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

(Fabrice Bellingard) #2

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!

(Fabrice Bellingard) #3

For further reference, here’s the PR on Travis Doc side to update the doc:

(Antoine Rey) #4

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

1 Like