1句的問題:「的Cobertura不會產生正確的代碼覆蓋率」關係
下面是我的pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>a.b.c</groupId>
<artifactId>MyProject</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<repositories>
<repository>
<id>google-api-services</id>
<url>http://google-api-client-libraries.appspot.com/mavenrepo</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.6</java-version>
<maven.test.skip.exec>false</maven.test.skip.exec>
<cobertura-maven-plugin.version>2.5.2</cobertura-maven-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.7.4</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<extensions>false</extensions>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.1.3</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura-maven-plugin.version}</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<check/>
</configuration>
<executions>
<execution>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura-maven-plugin.version}</version>
</plugin>
</plugins>
</reporting>
<dependencies>
...
</dependencies>
</project>
當我嘗試建立與此POM,2件事情發生
- 所有的測試運行2次
- 戰爭產生
- 的Cobertura報告顯示0%的覆蓋率
請幫我調試這個問題。
什麼是確切的'mvn'命令(和參數)的Cobertura你使用? – palacsint 2013-02-19 00:46:58
'mvn乾淨安裝' – JAM 2013-02-19 00:48:49
我會嘗試'mvn乾淨安裝cobertura:cobertura' – palacsint 2013-02-19 00:57:57