SonarQube projectBaseDir set to the first module on the list

Hi, Sonar community!

I’m running into problem trying to execute Sonar on multimodule Maven project from Jenkins. Im using Sonar Maven plugin 3.4.0.905. Sonar works perfectly fine when I don’t specify sonar.modules property, but when I do, it wrongly sets whole projects base directory to the first module’s base directory. My goal is to be able to set custom properties for each module, for example, name and sources directory. As far I as can understand right now, you can only achieve it by specifying modules property first - correct me if Im wrong. Also found same, but old dated issue, but couldn’t find any workarounds or fixes - https://issues.jenkins-ci.org/browse/JENKINS-24044.

P.S. sonar:sonar gave me exact same result

Thank you in advance!

Hi,

maybe this thread with a similar problem may be helpful

Gilbert

2 Likes

Hi,

Welcome to the community!

In addition to Gilbert’s helpful reference, I want to point out that with a Maven analysis (mvn sonar:sonar, right?) there’s no need to specify sonar.modules; the Maven-based analysis handles that for you. sonar.modules is provided for those times when you can’t analyze with Maven.

 
HTH,
Ann

1 Like

Hi, Ann and Gilbert!

Reading through the given reference and many other links on the web, I came to conclusion that I should rather play around in pom files than trying to set arguments to ‘mvn sonar:sonar -Dsonar.projectKey…’ It did work for me and indeed no need to specify modules anywhere. I suppose this is the correct way to work with Maven projects (Im newbie in maven myself as well), setting everything you need in pom files, but Im kinda intrigued with this interesting (I wanna call it) bug I was able to encounter.

Thank you both anyways, these were really quick responses!

Hope this won’t be only useful for myself,
Kamil

1 Like