Configuring Spring Boot project with multiple Maven modules

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

app
pom.xml

–modules:

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

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

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

        <sonar.organization>company-account</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <sonar.projectKey>project-name</sonar.projectKey>

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 sonar.host.url 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