I suggest removing the sonar.projectKey properties from the submodules and to add <sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
to the parent pom.
I created a sample project with multiple maven modules on GitLab that correctly sends merge request decoration:
I relaunched my pipeline but I still do not have any PR decoration.
For information, now that I re-imported the project again in SC the SONAR_TOKEN changed. I changed it also in my CI to be sure that it wonât be the blocker but it still not work anywayâŚ
I had a look at your project and it seems to me that we have kind of the same configurationâŚ
Because all of this changes, should I close the current MR and reopen a new one ?
Should I re-import the project in SC (I would avoid if possible )
Another question, my analysis on my testing branch has 0 issue and 100% of code coverage on the new code. Can it explain that if there is no issue, there is no PR decoration ?
Thanks again for your help, I am sur we will make it!
We can rule a maven configuration error then. Could you provide the ID of a background task that failed using your updated maven configuration? You can see this under Administration > Background Tasks
The issue is that the scanner does not recognize itâs scanning a PR. It only recognizes that itâs scanning a branch that is not the default branch (for example /feature/sonar-cleanup).
The scanner automatically reads the environment variables that are set by GitLab to link to the correct merge request. (This means that you donât have to set the sonar.pullrequest.key, sonar.pullrequest.branch and sonar.pullrequest.base properties yourself).
However if the scanner does find some manual configuration it does not try to automatically configure the parameters. We can check that this is the case by examining the debug logs.
Could add a -X parameter to your mvn verify sonar:sonar command to enable the debug logs?
If the scanner found some manual configuration it will log the following line:
Found manual configuration of branch/PR analysis. Skipping automatic configuration.
Yes, the issue was that the job we configured was without any rule or only that specifies to be run on Merge Request. As you explained, that means that we do not have the context that your scanner expect.
I just added the merge request in a dedicated only configuration and it works out of the box!