SonarCloud integration with TravisCI faulty step-by-step guide

  • Error observed:
    Build fails with:
[WARNING] Unable to analyse file 'pom.xml'.
java.lang.IllegalStateException: You're not authorized to run analysis. Please contact the project administrator.

Reason: One step from the step-by-step guide of integration with TravisCI is missing:
When requesting these properties to be added:

<sonar.projectKey>****</sonar.projectKey>
<sonar.organization>****</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

this one is missing:

<sonar.login>${env.SONAR_TOKEN}</sonar.login>

so even if we have created the SONAR_TOKEN in the SonarCloud context, the maven plugin can’t log in.

  • Steps to reproduce
    Follow the configure page on a GitHub repository which has a language which is not supported by default.

  • Potential workaround
    Add this line to the properties section of the step-by-step setup guide for TravisCI integration:

<sonar.login>${env.SONAR_TOKEN}</sonar.login>
  • ALM used: GitHub
  • CI system used: Travis CI

Hi @szgergo, thanks for your post and welcome to the community

I am not sure the message you shared reports a login failure. I would tend to think that it reports a lack of permission to run analysis. I would suggest to check the permissions of the user owning the token and checking it is entitled to the run analysis permission.

Regards
@AlxO

Hi!

I was able to fix it, by adding the properties above. The problem is that the documentation lacking these information. For example it is not there that you need to set the permission for the user on Administration page, or the above two properties.