【发布时间】:2011-12-20 10:08:59
【问题描述】:
我正在使用 Cobertura 和 Maven。
如果覆盖率低于给定阈值,我希望构建失败,但我希望仍然生成该站点(包括 Cobertura 报告)。这是因为开发人员需要参考覆盖率报告,以了解他们可以在哪里添加更多覆盖率来修复失败的构建。
目前我的 pom 看起来像:
<project>
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version>
<configuration>
<check>
<totalLineRate>${cobertura.check.totalLineRate}</totalLineRate>
</check>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version>
</plugin>
...
</plugins>
</reporting>
</project>
如果我运行mvn clean verify site,那么如果满足覆盖率目标,它会生成 HTML 覆盖率报告,但如果不满足覆盖率目标,它会导致构建失败而不生成报告。如何将其更改为始终生成报告?
【问题讨论】: