Shared modules between different projects

Hi,
I am using SonarQube 8.3 Community edition (we are also evaluating Developer edition)

I have 2 maven projects that contain common utilities (module1, module2) each in a different repository.
I have 2 other maven projects (proj1, proj2) where proj1 has a dependency of module1 and proj2 has dependency of module1 and module2.

when I run a scan using the sonar maven plugin, a project is created for each one of my projects which only display the issues form that specific module.
Can I configure proj1 to display also the issues from module1 and proj2 displays the issues of module1 and module2?

/repos/module1
->pom.xml
/repos/module2
->pom.xml
/repos/proj1
->pom.xml (dependency:module1)
/repos/proj2
->pom.xml (dependency:modul1, module2)

Thanks!

That will be tricky. I see 2 possibilities:

  • Create a parent pom that contains all the modules that you want to analyze at once
  • Configure the maven’s sonarscanner plugin, for example in proj1, to include the module1. The problem with this approach is that the scanner can’t rely on maven to get all the relevant information about module1 (like paths for source, compiled classes, dependencies, etc), so it will probably be a lot of work to manually configure all that.

thanks for trying to help.
in option 1 you mean createa master1 pom.xml that contains both module1, module2 and poj1 and master2 pom.xml that contains module1 and proj2?
that means that for every “master” it will analyze the commons modules in it again? is that not a problem?
thanks!

Yes. It’s not a problem to analyze the same code in different projects in SQ.