I'm running sonar-5.1.2 with Maven / Jenkins CI.
After googling and looking through similar questions (most of them are dated back to 2010-2012), it is still not clear how to exclude a particular Maven module from multi-module Maven project.
Module Exclusions property is deprecated since version 4.3 and should not be used anymore.
We have duplicating packages in different modules:
root pom.xml
|-module1
|-my.package.com
|-module2
|-my.package.com
Is it possible to exclude only files from module2/my.package.com
but include module1/my.package.com
?
SonarQube analysis is triggered by https://wiki.jenkins-ci.org/display/JENKINS/SonarQube+plugin post build action
There are two documented options to exclude a module from a SonarQube analysis; quoting:
You can either:
- use build profiles to exclude some module (like for integration tests)
- use Advanced Reactor Options (such as "-pl"). For example mvn sonar:sonar -pl !module2
Since you are using Jenkins, maybe the simpler solution is to use the -pl
option. This way, you won't change any configuration in your Maven project and you will only change Jenkins configuration.