我們有一個多項目,我們正在嘗試運行Cobertura測試報告作爲我們mvn站點構建的一部分。我可以讓Cobertura運行在子項目上,但是它錯誤地報告了0%的覆蓋率,儘管報告仍然突出顯示了單元測試打擊的代碼行。Maven2多項目Cobertura在mvn站點構建過程中報告問題
我們使用的是mvn 2.0.8。我試過運行mvn clean site
,mvn clean site:stage
和mvn clean package site
。我知道測試正在運行,它們在肯定的報告中顯示(包括txt/xml和站點報告)。我在配置中丟失了什麼嗎? Cobertura不適用於多項目嗎?
這是在父.pom:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>clean</id>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
</plugins>
</reporting>
我試着和沒有孩子.poms以下運行它:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
我的輸出得到這個編譯:
...
[INFO] [cobertura:instrument]
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 3 files to C:\workspaces\sandbox\CommonJsf\target\generated-classes\cobertura
Cobertura: Saved information on 3 classes.
Instrument time: 186ms
[INFO] Instrumentation was successful.
...
[INFO] Generating "Cobertura Test Coverage" report.
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 3 classes.
Report time: 481ms
[INFO] Cobertura Report generation was successful.
,報告如下: cobertura report http://trandem.com/images/cobertura.png
男人,你需要一個新的顯示器!我幾乎讀不出那些類名。 – 2008-09-18 23:27:41