4

I am new Cobertura I have written Test case and I use Lambda expression in coding and it is giving me an error how to solve this issue.

I search on google and came to know that Jacoco support Java8.

But how to insert jacoco plugin as Cobertura plugin i am not getting.

Cobertura plugin in my spring boot project pom.xml is like below:

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

Thanks.

Abhijeet Behare
  • 597
  • 1
  • 7
  • 21

1 Answers1

0

Like Cobertura - JaCoCo provides Maven plugin. Its description as well as examples can be found in JaCoCo documentation. As one of examples

<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>
Godin
  • 9,801
  • 2
  • 39
  • 76