0

I have a multi-module maven project. In my parent pom, it is like this -

<modules> 
    <module>a</module> 
    <module>b</module> 
    <module>c</module> 
</modules>

I want to scan a & b's src/main/java but c is having a different structure like this: c/src/main/dir1/dir2/dir3/js1 & c/src/main/dir1/dir2/dir4/js2 I want to scan project c till dir3 but exclued dir4

It has become complex and I don't know what to include and exclude. I am using maven scanner and passing parameter in sonarqube plugin in jenkins as parameters like this:

-Dsonar.projectName="MyProject" -Dsonar.sources="." -Dsonar.projectKey="MyKey" -Dsonar.inclusions="src/main/java/**,c/src/main/dir1/dir2/**" -Dsonar.exclusions="c/src/main/dir1/dir2/dir3" -Dsonar.scm.disabled=true -Dsonar.sourceEncoding=UTF-8

I have tried making it modular also using sonar.modules, but the excluding of the required directories is not happening. What am I doing wrong?

3AK
  • 1,223
  • 15
  • 22
  • If you are using the maven scanner, then `mvn sonar:sonar` is all you need, you don't need to specify `-Dsonar.sources=...` and probably none of the other `-D` parameters in your example. That is the whole point of the maven scanner, it understands your maven configuration. – janos May 12 '17 at 19:43

1 Answers1

0

The below answer is just a suggestion for you....

Don't use sonar.modules property

check out my answer in the below link

What is the correct way to configure an Android project with submodules for use with the sonarqube gradle plugin?

And configure exclusions in the sonarqube.gradle file of each module separately using the property

 // noinspection GroovyAssignabilityCheck
        property "sonar.exclusions", "src/main/java/com/appar/model/**, **/*Entity.java" 

This will solve your problem.

Community
  • 1
  • 1
Amal p
  • 2,882
  • 4
  • 29
  • 49