Error while setting up SonarCloud for a multimodule Maven project

Hi Wassim,

Welcome to the community!

Your third example is basically correct. The top level POM should have the following:

<sonar.projectKey>opencellsoft_core</sonar.projectKey>
<sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
<sonar.organization>opencellsoft</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

The basic idea is that for a multi-module analysis you only need to “sonarify” the top level POM and, in particular, add a parameterized sonar.moduleKey element, which you have done.

The error you are getting, “You’re not authorized to run analysis”, suggests that you may be using an incorrect project key or organization key. Or that you have not configured the correct SONAR_TOKEN environment variable / secret. Can you check these?

1 Like