我有maven 3,cobertura maven插件2.51和一些classe。 我需要知道我的课程的测试覆盖率。但我不想测试setter/getters。所以我只是想忽略它们而已。忽略课堂中的方法。 cobertura maven插件
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check>
<haltOnFailure>false</haltOnFailure>
<lineRate>55</lineRate>
<branchRate>60</branchRate>
<packageLineRate>60</packageLineRate>
<packageBranchRate>60</packageBranchRate>
<totalLineRate>60</totalLineRate>
<totalBranchRate>60</totalBranchRate>
</check>
<instrumentation>
<excludes>
<exclude>com/FileCopier*.*</exclude>
<exclude>com/FileCopierWithCamel*.*</exclude>
<exclude>com/Main*.*</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>cobertura</goal>
<goal>check</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
然后,添加以下忽略阻止
<ignores>
<!-- Ignore all setter and getter methods in your classes -->
<ignore>com.*.set*</ignore>
<ignore>com.*.get*</ignore>
<ignore>com.MyClass.getName</ignore>
</ignores>
但看起来这是行不通的。
我发现此链接: http://jira.codehaus.org/browse/MCOBERTURA-52 看起来像这个问题是5岁左右。 有没有我的问题的解决方案?