I have a Java project build with Maven analyzed with SonarQube. Each project consists of a couple of Maven modules, let's say:
org.acme.module
- APIorg.acme.module.demo
- a small demo application demonstrating the features of this moduleorg.acme.module.doc
- documentation for developersorg.acme.module.it
- integration tests
In an ideal world I'd want to analyze the code quality of all of these modules, but calculate the test coverage only for the API.
However I could not find a way to disable entire projects from the code coverage (sonar.coverage.exclusions
only filters the class name, and some of these modules share a package with the API), so now I'm trying to disable these modules from Sonar.
I tried:
<properties>
<sonar.skippedModules>org.acme.module.demo,org.acme.module.doc,org.acme.module.it</sonar.skippedModules>
</properties>
Which works, but is a lot of work, since I have hundreds of these projects.
<properties>
<sonar.skip>true</sonar.skip>
</properties>
Works too, but I have to define it similarly for every single sub-module. Also, now Sonar won't analyze the files, which is bad for obvious reasons.
I'd rather have something like <excludedModules>*demo*,*doc*,*it*,<excludedModules>
which I could define once in the parent pom.xml and use in all these modules.
This answer states:
You could also do this from the sonar admin page as documented in the Skipping Modules section here.
I was so happy for a moment until I realized the SonarQube documentation does not contain the "Skipping Modules" section anymore. Or maybe it was moved and I just can't find it.
How do I skip the code coverage analysis in multiple modules while still running other Sonar tests?
Or if that's not possible, how to skip these modules in Sonar in a generic way?