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
3
votes
0 answers

Unable to import externally generated it-jacoco.exec report into Sonar

I was able to startup my multi-module application instance located on a different server than my jenkins build server with the following JVM option : "-javaagent:${MAIN_DIR}/lib/jacocoagent.jar==destfile=/jacoco.exec,output=tcpserver,address=*" In…
lbarriau
  • 41
  • 1
  • 6
2
votes
3 answers

jacoco configuration for multi module is not working

There is something strange going on with my jacoco configuration and I am not able to figure it out. I have visited multiple threads on stack overflow and other platforms and tried many thing, but didn't resolve this issue. I have setup the java…
Lokesh Pandey
  • 1,739
  • 23
  • 50
2
votes
0 answers

Jacoco missing coverage when test is created

I have a project with spring-boot 2, JUnit 4, jacoco 0.8.6 and I use maven to run unit test, I have the following class: @Component public class AccountVOValidator implements FormValidator { @Override public void…
2
votes
1 answer

Maven - why does running a build of multiple packages result in a different result?

Let's say I have a project with 2 modules, and 3 pom.xml files (1 for Module A, 1 for Module B, 1 parent pom.xml) I've added the following plugin that verifies the code coverage diff between my changeset and another branch, and fails if it's below a…
Koopa
  • 23
  • 5
2
votes
1 answer

What changed in the last year that affects test coverage in jacoco-maven-plugin?

I'm learning about test coverage and struggling to reach the percentages asked in one of the course projects. To illustrate the issue, see this repository (picked because they pushed their target folder back…
2
votes
0 answers

Is there a way to get unique jacoco .exec file names?

Currently at my internship, I have my Jacoco-Maven plugin set up such that after the unit and integration reports are generated, they are merged into one. Now, adding CircleCI into the mix, we run parallel jobs for our tests. These jobs cause only…
2
votes
0 answers

How to add an annotation to exclude a package from JaCoCo code coverage report?

I wrote the following custom annotation to exclude elements from JaCoCo code coverage @Inherited @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PACKAGE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) public @interface…
c_anirudh
  • 375
  • 1
  • 22
2
votes
1 answer

How to merge jacoco reports of two different version - 0.7.9 and 0.8.7

I have execs report of two different jacoco plugins from two different projects - 0.7.9 and 0.8.7 version of jacoco. I want to merge and show a single report. Is it possible?
2
votes
0 answers

Jacoco report in JUnit report output directory

I have a simple Maven project configured to generate a JUnit report with the Surefire plugin, and a coverage report with Jacoco. After running mvn test, I expect to find: jacoco report files in reports/jacoco surefire-report.html in…
Phil
  • 598
  • 1
  • 9
  • 21
2
votes
0 answers

SonarQube code coverage does not work for Kotlin files which contains various classes

I am facing an issue with SonarQube 8.9 and the latest jacoco-maven-plugin 0.8.7. I have a Kotlin project which is scanned by SonarQube for code coverage, all of my test files are well considered for coverage except kotlin test files which contain…
Nono
  • 43
  • 2
  • 8
2
votes
1 answer

Jacoco unable to exclude some packages and classes using in pom.xml

I am trying to exclude certain package and classes from Jacoco coverage since they are deprecated. I tried adding exclude in Jacoco plugin as below but when I look at the Jenkins report on Jenkins, I see all those classes as well not covered and the…
Atihska
  • 4,803
  • 10
  • 56
  • 98
2
votes
0 answers

Karate tests run successfully but code coverage shows zero

Hi I have a problem the code coverage shows 0% but tests run successfully and jacoco shows 0 code coverage for the successfully run tests. I followed the configuration shared in this link for jacoco but still it did not…
2
votes
0 answers

Jacoco shows lines are not covered even though IntelliJIdea static code analyser says they are covered

Environment: Java 8 / SpringBoot v2.0.2 / IntelliJIdea (Ultimate Edition - 2020.3.2) / I have this static method public static boolean isAvailable(final Price price) { if (price == null) { return false; } boolean isAvailable = true; BigDecimal…
samme4life
  • 1,143
  • 2
  • 14
  • 20
2
votes
0 answers

Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.5:report-integration

It runs on different machine, but not on mine, i run it on docker on Mac, i've tried restarting docker and machine itself. Below is my stacktrace of mvn clean install -e Caused by: java.io.EOFException at java.io.DataInputStream.readByte…
2
votes
0 answers

Surefire 2.22.0 : java.lang.IllegalStateException: error [STOPPED] to read process

When i execute unit tests i get this error from surefire plugin am using maven-surefire-plugin, jacoco plugin and junit 4.12. This is the plugins from my pom : org.apache.maven.plugins