2013-03-14 114 views
2

我一直在閱讀關於S.O.的問題。儘管應用了上述修復,但仍然沒有結果。Maven Cobertura HTML報告沒有生成

我只是想要一份關於我的Cobertura報道的html報告,但是我的任何目標目錄都沒有生成任何報告。下面是相關的pom.xml片段

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 

    <build> 
    <sourceDirectory>src/main/java</sourceDirectory> 
    <plugins>   
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>cobertura-maven-plugin</artifactId> 
     <configuration> 
     <formats> 
      <format>html</format> 
     </formats> 
     </configuration> 
     <executions> 
      <execution> 
      <goals> 
       <goal>clean</goal> 
       <goal>check</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.3.2</version> 
     <configuration> 
      <source>${java-version}</source> 
      <target>${java-version}</target> 
     </configuration> 
     </plugin>  
     <plugin> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>2.2</version> 
     <configuration> 
      <warSourceDirectory>src/main/webapp</warSourceDirectory> 
      <failOnMissingWebXml>true</failOnMissingWebXml> 
     </configuration> 
     </plugin> 
    </plugins> 

    <pluginManagement> 
     <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-site-plugin</artifactId> 
      <version>3.2</version> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-project-info-reports-plugin</artifactId> 
      <version>2.6</version> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>cobertura-maven-plugin</artifactId> 
      <version>2.5.2</version> 
      <configuration> 
      <instrumentation>   

      </instrumentation> 
      <check> 
       <haltOnFailure>true</haltOnFailure> 
       <branchRate>75</branchRate> 
       <lineRate>75</lineRate> 
       <totalBranchRate>75</totalBranchRate> 
       <totalLineRate>75</totalLineRate> 
       <packageBranchRate>75</packageBranchRate> 
       <packageLineRate>75</packageLineRate> 
      </check> 
      </configuration> 
     </plugin>   
     </plugins> 
    </pluginManagement> 
    </build> 


    <dependencies> 


    <!-- testing stuff --> 
     <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>${junit.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-test</artifactId> 
     <version>${org.springframework-version}</version> 
     <scope>test</scope> 
    </dependency>  

    </dependencies> 

    <!-- Reporting --> 
    <reporting> 
    <plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>cobertura-maven-plugin</artifactId> 
     <version>2.5.2</version> 
     <configuration> 
     <formats> 
     <format>html</format> 
     </formats> 
     </configuration> 
     </plugin>   
    </plugins> 
    </reporting> 
</project> 

回答

0

您需要的cobertura目標添加到您的POM。

+0

將cobertura添加到目標,導致報告生成。 – cxdf 2014-11-06 00:07:32