Is there still no solution for ignoring setter/getter (other trivial methods) with the cobertura-maven-plugin?

最后都变了- 提交于 2019-12-04 22:51:28
dwegener

Since Cobertura 2.0 there is a switch to exclude trivial methods:

[Cobertura Changelog] New --ignoreTrivial switch that tells Cobertura to ignore the following in the coverage report: Getter methods that simply read a class field; Setter methods that set a class field; Constructors that only set class fields and call a super class constructor.

The cobertura-maven-plugin uses Cobertura 2.x since version 2.6 (see release notes). But i have not yet found a way to pass the switch to the maven plugin configuration.


Although there seems to be some confusion about the state of this feature (see this Jira issue), the flag does seem to work with the following configuration:

<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
  <instrumentation>
    <ignoreTrivial>true</ignoreTrivial>                 
  </instrumentation>
</configuration>

The exclusion problem was fixed here:

http://jira.codehaus.org/browse/MCOBERTURA-52

and it's part of the latest release (2.5.2). It's available since 10 Sept. 2012:

http://search.maven.org/#search|gav|1|g%3A%22org.codehaus.mojo%22%20AND%20a%3A%22cobertura-maven-plugin%22
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!