Questions tagged [jacoco-maven-plugin]

A maven plug-in which provides the JaCoCo agent to automated tests and allows basic report creation.

This plugin lets the build process load the agent runtime in the pre-test phases, allowing additional configuration in the file, and generate test documentation in the verify phase.

Usage

The Maven plug-in can be included in your build with the following declaration:

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>0.7.8</version>
</plugin>

To receive a full list of goals and available parameters you can use maven-help-plugin:

mvn help:describe -Dplugin=org.jacoco:jacoco-maven-plugin -Ddetail

More Info

401 questions
146
votes
9 answers

Maven Jacoco Configuration - Exclude classes/packages from report not working

I have a maven multi-module project and I'm using jacoco-maven for code coverage reports. Some classes should not be reported, as they're Spring configuration and I'm not interested in them. I have declared the maven-jacoco plugin as…
resilva87
  • 3,325
  • 5
  • 32
  • 43
58
votes
4 answers

JaCoCo: exclude generated methods (using it with Lombok)

I am using JaCoCo and it is considering methods generated by Lombok (generated in the bytecode, not trace of them in the source code). How can I configure JaCoCo to ignore them?
Federico Tomassetti
  • 2,100
  • 1
  • 19
  • 26
38
votes
6 answers

Jacoco Maven multi module project coverage

Seems like there are couple of questions, which are quite old and things changed from Java 8 support of Jacoco. My Project contains following structure pom.xml | | -----sub module A pom.xml | | -----sub module B pom.xml | | -----sub module C…
RaceBase
  • 18,428
  • 47
  • 141
  • 202
30
votes
2 answers

Excluding Lombok classes from Sonar coverage report

Latest Jacoco plugin (still in snapshot version, 0.7.10-SNAPSHOT), has a nice new feature to filter out the Lombok generated code (https://github.com/jacoco/jacoco/wiki/FilteringOptions). All we need to do is add a lombok.config file at the root of…
Vincent F
  • 6,523
  • 7
  • 37
  • 79
27
votes
4 answers

How to skip jacoco coverage check during build?

In our project we use jacoco-maven-plugin and during the build I get this error: [ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.5:check (jacoco-check) on project my-project: Coverage checks have not been met. See log for details.…
IKo
  • 4,998
  • 8
  • 34
  • 54
27
votes
6 answers

JaCoCo with Maven - missing execution data file

We have a Maven multi module project consisting of a parent (HelloWorld) and different children (HelloWorldServices and HelloWorldPresentation) and use Jenkins to build. The error after running the successful test is [INFO] ---…
dasLort
  • 1,264
  • 1
  • 13
  • 28
21
votes
4 answers

Sonarqube bad coverage because of lombok @Data

I use jacoco for coverage report. When I look at the jacoco report, coverage seems to be good. But in Sonarqube, the coverage is low because it says that @Dataannotation from lombok is not cover by test. Compiled classes is mark as @Generated but…
Martin Choraine
  • 2,296
  • 3
  • 20
  • 37
20
votes
1 answer

Reporting and Merging multi-module jacoco reports with report-aggregate

Attempting to get one jacoco report that will show all the results from multiple modules. I am able to see that each of the sub-modules have a jacoco.exec after building the project but unsure of how to get it to output one report that will have all…
kingz415
  • 301
  • 1
  • 2
  • 3
20
votes
2 answers

Trouble configuring JaCoCo in maven

I am trying to do a simple JaCoCo report through Maven and I keep getting the same error. Here is a snippet of my plugin. org.jacoco jacoco-maven-plugin
Dubius
  • 428
  • 1
  • 5
  • 11
18
votes
4 answers

An error has occured in JaCoCo report generation

I'm currently trying to add JaCoCo as a dependency on my spring boot maven project to see the code coverage for my unit tests. However, when I run the tests, it fails with error. Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.3:report…
John
  • 243
  • 2
  • 4
  • 9
18
votes
3 answers

Exclude Setters and Getters in JaCoCo Code Coverage

With the cobertura-maven-plugin setters and getters can be excluded from code coverage using the ignoreTrivial option. Is there also such a possibility with the jacoco-maven-plugin? This is my current configuration:
Benny Code
  • 51,456
  • 28
  • 233
  • 198
15
votes
5 answers

How to exclude a line from jacoco code coverage?

How would i exclude inputStream.close() from jacoco code coverage, in pom.xml or in the java code? public void run() { InputStream inputStream = null; try { inputStream = fileSystem.newFileInputStream(file); } finally { …
nommer
  • 2,730
  • 3
  • 29
  • 44
15
votes
2 answers

Jacoco - "Caused by: java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_6da5971.Offline"

Trying to get coverage via jacoco using offline instrumentation (can't use on-the-fly instrumentation: due to powermock testcases) for a maven project.Added the jacocoagent.jar to classpath in surefire plugin as shown below. Renamed the…
gthy
  • 301
  • 1
  • 3
  • 10
14
votes
6 answers

JaCoCo and missed coverage of private default constructor

I'd like to see an example to prevent JaCoCo to report private empty constructors as non-covered code in a Java class. In the maven plugin configuration I have CLASS
mat_boy
  • 12,998
  • 22
  • 72
  • 116
14
votes
4 answers

How to add static member variables Jacoco Test Coverage?

I have a class as following: public class XConstants { public static final int A_TYPE = 1; public static final int B_TYPE = 2; } I am using both variables in my tests but when I examine the test coverage with Jacoco it shows %0 test…
Murat Ayan
  • 575
  • 4
  • 19
1
2 3
26 27