Exclude setters and recipients in JaCoCo code encoding

Using the cobertura-maven-plugin setters and getters can be excluded from code coverage using the ignoreTrivial option. Is there such a possibility with jacoco-maven-plugin ?

This is my current configuration:

 <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.1.201405082137</version> <configuration> <excludes> <exclude>com/welovecoding/web/blog/test/**/*.class</exclude> </excludes> </configuration> <executions> <execution> <id>amend-unit-test-java-agent-option</id> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> 
+7
setter getter code-coverage jacoco jacoco-maven-plugin
source share
2 answers

Not officially supported; see comments in:

https://github.com/jacoco/jacoco/issues/15

mentioned solution:

This is a long time since the discovery of this problem. This is a really interesting feature. For example, it is implemented in clover and corbetura. There are forks that implement filtering: github.com/huangxiwei/jacoco, https://github.com/mchr3k/jacoco since the beginning of the year. Why don't you combine these forks into a master branch? Even if all filtering is not performed at startup, the necessary basic filters are listed on the wiki page you wrote (try with resources, synchronization, enumerated static methods). Coverage is a very useful tool, the more it charges more, it will be useful. This helps when coverage reaches high value; it helps to focus on the right classes.

+10
source share

I recommend using Cobertura, which has no such restriction, as well as not many false positive warnings.

-5
source share

All Articles