Unable to analyze pom.xml. java.lang.IllegalStateException: You're not authorized to run analysis. Please contact the project administrator

  • ALM used:
    GitHub

  • Scanner command used
    mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -DskipTests=true -Dsonar.login=[redacted]
    I have added these in the pom.xml of the parent project:
    <sonar.organization>findorgri</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>

  • Languages of the repository
    Mainly Java

  • SonarCloud Project URL
    https://sonarcloud.io/project/configuration?id=Findorgri_WebGoat-new

  • Error observed
    The project has many sub-modules. For every sub-module of the project I get this:

[WARNING] Unable to analyse file 'webgoat-lessons/xxe/pom.xml'.
java.lang.IllegalStateException: You're not authorized to run analysis. Please contact the project administrator.
[stacktrace omitted]

Hi @Findorgri

Do the sub modules inherit the configuration of the Sonar Scanner plugin?

Cheers,
Mark

Hi @Mark_Rekveld
If you mean the properties <sonar.organization> and <sonar.host.url> in the pom.xml, they do. At least they should. Each submodule’s pom.xml has a parent, this is how the project works irrespective of the sonar properties.
I thought to check that too before I posted here. I tried adding the properties directly to one of the submodules’ pom.xml, but I got the same error.
Tell me if you need me to post any more details.
Thanks

After some more searching I returned to an issue I had before the one I posted here originally for:
According to the instructions of SonarCloud I need to define the sonar.projectKey property along with the sonar.organization and sonar.host.url properties. When I first tried this, running the sonar scanner with this property resulted in an error that two modules can’t have the same name. Back then, I found some post saying that this is because it’s a multi module project and that I should omit the sonar.projectKey property, which would result in SonarQube using groupId:artifactId by default. After trying this, I got to the error I posted originally for.
What I changed now and made it work:
I added back the sonar.projectKey property, but also the sonar.moduleKey property, which I defined to be {project.groupId}:{project.artifactId}. After that, the project was analyzed successfully.
To reiterate, additionally to the
<sonar.organization>findorgri</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
properties that I mentioned in my original post, I added the
<sonar.projectKey>Findorgri_WebGoat-new</sonar.projectKey>
<sonar.moduleKey>{project.groupId}:{project.artifactId}</sonar.moduleKey>.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.