cobertura 支持 java 8 吗?因为我想使用 java8 lambda 表达式,它给我一个错误

Does cobertura support java 8 ?Because i want to use java8 labmda expression and it is giving me an error

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

我在 google 上搜索并了解到 Jacoco 支持 Java8。

但是我不知道如何插入 jacoco 插件作为 Cobertura 插件。

我的 spring 引导项目 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>

谢谢。

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

<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>