I have two projects (A and B), which use the same reusable module (C). I upload A into sonarqube without problems, but when I upload B, the sonar-maven-plugin tells me that Module C is already part of project A. How can I fix it? I want both of my projects to be uploaded into sonarqube.
I just had this problem as well. If you are running a newer version of Maven, you can exclude modules. This may or may not be a sufficient answer for you, but it was for me.
When you run Sonar on project A, run it normally (no --projects switch). When you run Sonar on project B, supply an exclusion list (with the --projects switch).
For Project A:
mvn sonar:sonar --projects !moduleC
This method is mentioned briefly here: