Maven – JaCoCo code coverage example

In this article, we will show you how to use a JaCoCo Maven plugin to generate a code coverage report for a Java project. Tested with Maven 3.5.3 JUnit 5.3.1 jacoco-maven-plugin 0.8.2 Note JaCoCo is an actively developed line coverage tool, that is used to measure how many lines of our code are tested. 1. …

Read more

Gradle JaCoCo – Incompatible version 1006

A Gradle build + JaCoCo coverage report. build.gradle apply plugin: ‘java’ apply plugin: ‘eclipse-wtp’ apply plugin: ‘jacoco’ //code coverage repositories { mavenLocal() mavenCentral() } jacoco { toolVersion = "0.7.5+" } jacocoTestReport { reports { html.enabled = true xml.enabled = true csv.enabled = false } } P.S Tested with Gradle 2.10 1. Problem 1.1 Run the …

Read more

Maven + Emma code coverage example

Emma is a free Java code coverage tool. In this tutorial, we will show you how to use Maven to generate the Emma code coverage report for your project, and also how to integrate the Emma report into the Maven project site. 1. Generate Emma Code Coverage Report Do nothing, just type the following Maven …

Read more

Emma – Class x appears to be instrumented already

Review the “maven-emma-plugin” in pom.xml : pom.xml <project> //… <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin</artifactId> <version>1.0-alpha-3</version> <inherited>true</inherited> <executions> <execution> <phase>process-classes</phase> <goals> <goal>instrument</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <inherited>true</inherited> <configuration> <forkMode>once</forkMode> <reportFormat>xml</reportFormat> <classesDirectory> ${project.build.directory}/generated-classes/emma/classes </classesDirectory> </configuration> </plugin> </plugins> </build> </project> 1. Problem When I run the command mvn emma:emma to generate the code coverage report, …

Read more