4

我是新的 Cobertura 我已经编写了测试用例,我在编码中使用了 Lambda 表达式,它给了我一个错误,如何解决这个问题。

我在谷歌上搜索并知道 Jacoco 支持 Java8。

但是如何插入 jacoco 插件作为 Cobertura 插件我没有得到。

我的 Spring Boot 项目 pom.xml 中的 Cobertura 插件如下所示:

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <!-- <check> <branchRate>85</branchRate> <lineRate>85</lineRate> <haltOnFailure>true</haltOnFailure> 
                        <totalBranchRate>85</totalBranchRate> <totalLineRate>85</totalLineRate> <packageLineRate>85</packageLineRate> 
                        <packageBranchRate>85</packageBranchRate> </check> -->
                    <formats>
                        <format>xml</format>
                    </formats>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>cobertura</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

谢谢。

4

1 回答 1

0

像 Cobertura - JaCoCo 提供 Maven 插件。它的描述和示例可以在JaCoCo 文档中找到。作为例子之一

<build>
  <plugins>
    <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <version>0.8.4</version>
      <executions>
        <execution>
          <goals>
            <goal>prepare-agent</goal>
            <goal>report</goal>
          </goals>
        </execution>
于 2016-12-02T16:36:03.743 回答