1

我一直在阅读关于 SO 的问题,尽管应用了提到的修复程序,但仍然没有结果。

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

1 回答 1

0

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

于 2014-11-05T21:35:07.207 回答