I am trying to scan with Sonarqube a multi-module maven project with a structure like this:
parent-project --project-A pom-A --projectB pomB pomParent bom-project -- pomBom
I am building the project with reactor, launched from an external BOM project that includes all needed configuration, including the sonar properties. So, in my example, pomParent extends pomBom, pom-A and pom-B extends pomParent. And I am doing this from a gitlab pipeline.
In the sonarqube-check job of the pipeline, I do something like this
- cd bom-project - mvn -pl "../parent-project/$SRC_DIR" install -am -Dmaven.test.skip -Dskip.checkstyle - mvn -pl "../parent-project/$SRC_DIR" verify - cd "parent-project/$SRC_DIR" - mvn sonar:sonar -Dsonar.projectKey=parent-project-key
where SRC_DIR could be project-A, project-B, etc
The analysis reaches Sonarqube for every sub-project, but the issue is that every project execution overwrites the previous one. Analysis of projectB overwrites analysis of projectA. Sonarqube is not keeping the mutimodule structure, it keeps only one level, instead of two (parent and children).
I have looked in the internet for different solutions, like running sonar:sonar in the BOM folder specifying the sub-project, but did not work. Actually, the available information of how shoud I proceed is not clear for me.
Sonarqube instance is a corporative one (in the cloud). Not sure of the current version (I can re-check) but for sure is a recent one.
Hope I am clear. Any help is appreciated. Thank you!