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
Remove module2 in your root
pom.xml
.<modules> <module>module1<module> </modules>
There are two documented options to exclude a module from a SonarQube analysis; quoting:
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.As documented here you can define property
in the pom.xml of the module you want to exclude