Maven Cobertura HTML报告没有生成

时间:2013-03-14 16:27:16

标签: java html maven report cobertura

我一直在阅读有关S.O.的问题。尽管应用了上述修复,仍然没有结果。

我只想要一份关于我的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>

1 个答案:

答案 0 :(得分:0)

您需要将cobertura目标添加到您的pom中。