Reputation: 3020
I'm trying to exclude some packages from the Jacoco coverage scan, but it's not working like how I would expect. Here's my Maven POM configuration for Jacoco:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<configuration>
<excludes>
<exclude>**/pojo/**/*</exclude>
</excludes>
</configuration>
</plugin>
The behavior I'm experiencing is that the files are being set to 0% lines covered instead of reducing the total lines to cover, which is actually reducing my coverage percentage. So how do I correct this?
EDIT: A workaround for this issue is to remove the file entirely from SonarQube using sonar properties:
<sonar.exclusions>**/pojo/**/*</sonar.exclusions>
However, this is just a workaround since now I can't see code smells from those files (there probably aren't any since they are POJOs, but I like the sense of security of knowing for a fact there are no code smells).
Upvotes: 1
Views: 1097
Reputation: 1870
Total lines of code in Sonar are not totally managed by Jacoco. You need to add this property to your pom.xml
:
<properties>
<sonar.coverage.exclusions>**/pojo/**/*</sonar.coverage.exclusions>
</properties>
Upvotes: 1