我一直在使用Cobertura插件進行報告生成和檢測(具有surefire)。 這裏是我所面臨的問題:忽略爲cobertura maven插件中的特定類生成報告
我無法把這個插件忽略報表生成在我的項目的具體類別。
PF低於pom.xml的相關摘錄,我已經添加了忽略標記,但這只是忽略了忽略類的檢測。
我希望特定項目的報告根本不會生成。首先,由於我對Maven和Conberture的知識有限,我想知道它是否可行,如果是,那麼我需要在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
我試着在模塊/ pom.xml中以下
<instrumentation>
<excludes>
<exclude>**/apps/*.*</exclude>
</excludes>
</instrumentation>
我仍然可以在警報和公司目錄中生成報告。
也許排除正則表達式是不正確的?
我正在調查這個問題。而且它非常惱人,因爲我得到了很多不被忽視的報道。任何已知的解決方法? – 2011-03-25 13:05:59
我到現在爲止唯一可能的解決方法是,包括兒童POM中的插件,用於要生成報告的兒童。除此之外,沒有其他可行的方法可以完成AFAIK。 – Neeraj 2011-03-26 02:25:21
這個bug現在已經在cobertura maven插件的版本2.5.2中最近修復了 – Ben 2012-11-07 23:34:27