how to configure sonarqube in multi maven project running from jenkins

640 views Asked by At

assuming you have a maven module with the following structure:

  • root module
    • integration test module
    • sources module A
    • sources module B
    • additional modules...

and you have a pipeline in jenkins which use multiple jobs as part of the build process: preliminary job that compile all modules, and then, additional job that runs the integrations test by executing a maven command on the integration tests module.

now, in sonarqube server, you would like to see all of the sources from all modules, and for each of them, the coverage data.

from what I understand, there are two ways to accomplish this, and the first way is preferable -

we tried to configure the base directory property (sonar.projectBaseDir) as a maven parameter, pom property and in sonar-project.properties file. (also tried an absolute and relative paths)

no matter what we tried, it seems that the base folder is not affecting sonar. as you can see in the picture below (base dir), and by reviewing results in sonar server, the only files that we get are files that located inside integration-tests module (inner module). while we would like that the analysis will be done regarding all the files inside the parent module.

enter image description here

Additional data:

list of sonar parameters (passed by maven)-

sonar.host.url=$SONAR_HOST_URL
sonar.login=$SONAR_AUTH_TOKEN
sonar.sources=src/main
sonar.projectBaseDir=../
sonar.jacoco.reportPaths=**/target/jacoco-it.exec

I am using the following versions:

  • Sonarqube server: 7.3
  • sonar-maven-plugin: 3.5.0.1254.

Am I missing something? does sonar support this kind of configuration? I would appreciate any help..

0

There are 0 answers