首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven Cobertura HTML报告未生成

Maven Cobertura HTML报告未生成
EN

Stack Overflow用户
提问于 2013-03-15 00:27:16
回答 1查看 952关注 0票数 1

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

我只是想要一个关于我的Cobertura覆盖率的html报告,但在我的任何目标目录中都没有产生任何内容。下面是相关的pom.xml代码片段

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

发布于 2014-11-06 05:35:07

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15414843

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档