user3920253 user3920253 - 1 year ago 273
Java Question

<sonar.exclusions> in pom.xml (Maven multi-module project) works locally but not on company server

I'm using

in pom.xml to exclude certain packages for unit test code coverage. I have set up Sonar locally and the exclusions reflect on the report. But then, the same exclusions are not honored on the company server.

I am using
which works as intended and skips the required modules perfectly fine on both environments.

Local Sonar version is Version 4.3.1 Company's Sonar version is Version 4.1.2

An example of how I have written
in one of the modules:


Can you please help me understand why
is honored only locally but not when I build the job (set up on Jenkins) to generate the Sonar report on the company server? Does the difference in the version matter?

Would absence of new-line character following the comma to separate the package names make a difference?

Answer Source

Try this, I had same issue and it worked for me

Don't start with "/src/main/java/" Instead start with "com/companyname/projectname/"

I personally prefer "**com/companyname/projectname/../**"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download