Configuring Spring Boot project with multiple Maven modules

Hi folks,
I have a web project with following structure:



app-api (contains only OpenAPI documentation used to generate REST endpoints)

app-service (contains the actual business logic with services/controllers/etc)

I am trying to manually run SonarCloud.
I put the following settings in the parent pom.xml


All of the above are taken according to what the Sonar web portal is recommending.
I added the SONAR_TOKEN variable as well.

At the moment I am getting "Project ‘…’ can’t have 2 modules with the following key: …

I tried a bunch of other combinations, like putting the maven properties in the service submodule.
It either does not recognize the project or gives me a stackoverflow error.

Do you have any idea what am I doing wrong?

Hey there.

This can happen when passing sonar.projectKey in the pom.xml of a project (and only sonar.projectKey. sonar.organization and work fine in the POM).

If you pass it as an analysis parameter to mvn sonar:sonar (like mvn sonar:sonar -Dsonar.projectKey=project-name, you shouldn’t face the issue.

Thanks! When I do it as a parameter it just gives another error:
Project not found. Please check the ‘sonar.projectKey’ and ‘sonar.organization’ properties, the ‘SONAR_TOKEN’ environment variable, or contact the project administrator