问题描述
我一直在使用Cobertura插件进行报告生成和检测(使用surefire).这是我面临的问题:
I've been using Cobertura plugin for report generation and instrumentation (with surefire).Here is the issue I am facing:
在pom.xml的相关摘录下面的PF处,我添加了ignore标签,但这只是忽略了被忽略类的检测.
PF below the related excerpt from pom.xml, I have added the ignore tag, but that just ignores instrumentation for the ignored classes.
我希望完全不生成特定项目的报告.
I want the report for specific projects to not be generated at all.
首先,由于我对Maven和Conberture的了解有限,我想知道是否有可能,如果可以,那么我需要在pom.xml中进行哪些更改.
Firstly, due to my limited knowledge of both Maven and Conberture, I want to know is it possible, and if yes, then what are the changes I need to get done in pom.xml.
pom.xml
<report>
<!-- other plugins exist but are not important to be listed here I guess -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>false</skipTests>
<systemProperties>
<property>
<name>net.sourceforge.cobertura.datafile</name>
<value>target/cobertura/cobertura.ser</value>
</property>
</systemProperties>
</configuration>
</plugin>
<!-- The following is the plugin for cobertura, which takes care of integration and report generation-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<check>
<branchRate>50</branchRate>
<lineRate>50</lineRate>
<haltOnFailure>true</haltOnFailure>
<totalBranchRate>50</totalBranchRate>
<totalLineRate>50</totalLineRate>
<packageLineRate>50</packageLineRate>
<packageBranchRate>50</packageBranchRate>
</check>
<instrumentation>
<ignores>
<ignore>deshaw.dportal.alert.*</ignore>
<ignore>deshaw.dportal.atc.*</ignore>
<ignore>deshaw.dportal.basket.*</ignore>
<ignore>deshaw.dportal.fcs.*</ignore>
<ignore>deshaw.dportal.event.*</ignore>
<ignore>deshaw.dportal.filings.*</ignore>
<ignore>deshaw.dportal.glg.*</ignore>
<ignore>deshaw.dportal.icp.*</ignore>
</ignores>
</instrumentation>
</configuration>
</plugin>
</report>
这是我的目录结构:
module
|
|-apps
| |-alert
| | |-src
| | |-target
| | |-pom.xml
| |-------------------
| |-company
| | |-src
| | |-target
| | |-pom.xml
|-----------------------
|-jobs
| |-job1
| | |-src
| | |-target
| | |-pom.xml
| |-job2
| | |-src
| | |-target
| | |-pom.xml
我在module/pom.xml中尝试了以下内容
I tried the following in module/pom.xml
<instrumentation>
<excludes>
<exclude>**/apps/*.*</exclude>
</excludes>
</instrumentation>
我仍然在警报和公司目录中都生成了报告.
I still get the reports being generated in both the alerts and company directory.
排除正则表达式可能不正确吗?
Probably the exclude regex is not right?
推荐答案
Cobertura maven插件不尊重排除和忽略报告的生成,但是出于检测目的.
Cobertura maven plugin does not respect exclusion and ignoring for report generation.It does so for instrumentation though.
在以下位置报告了已知错误: http://jira.codehaus.org/browse/MCOBERTURA-52
Known bug reported at : http://jira.codehaus.org/browse/MCOBERTURA-52
这篇关于忽略Cobertura Maven插件中特定类的报告生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!