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
7
votes
4 answers

JaCoCo Not Generating Coverage Reports based on Source File - Method names not clickable

I have a Maven multi module project where the JaCoCo is not generating reports based on the source files. Generally, if MyService is the class under test, it would be reported in two ways, one through a file name MyService.html in appropriate…
Pavan Kumar
  • 4,182
  • 1
  • 30
  • 45
7
votes
1 answer

Aggregated Coverage or Coverage in the dependent modules not shown in SonarQube + Reports are generated by Jacoco

I am running jacoco plugin to generate html , xml and jacoco.exec reports to measure the coverage of the code tested by my testNg tests. I am successful in the generation of these reports in my local as well as in Jenkins and all my unit test…
JITHIN_PATHROSE
  • 1,134
  • 4
  • 14
  • 29
7
votes
3 answers

How to specify output format for jacoco plugin for maven?

I have a maven project with jacoco plugin, which generates reports in different formats, such as html, csv and xml. But I need only html. How can I specify it? Here is some code, where I add jacoco plugin:
Viktoria
  • 73
  • 1
  • 1
  • 4
7
votes
1 answer

Merge Multiple Test Runs into one Jacoco.exec file

In my project based on environment variable different set of integration tests are run. For e.g. mvn test -Dconfig=a mvn test -Dconfig=b Running both lines gives full test coverage. Now the problem is that each run will create a jacoco.exec file in…
Spandan Thakur
  • 338
  • 2
  • 14
6
votes
1 answer

What does JaCoCo rule elements mean and how to combine them

I'm trying to understand JaCoCo rules but there are not many great examples around. Every thread I see circulates the same examples from the docs. I see 3 different metrics: element types (BUNDLE, PACKAGE, CLASS, SOURCEFILE or METHOD) limits…
Skod
  • 435
  • 6
  • 16
6
votes
3 answers

sonarQube fails to generate coverage file

Im having trouble getting sonarQube to output the coverage report of my java Spring project. Because of this it always displays 0.0% coverage in the interface. I followed this and it still will not generate the file. The following is the relevant…
MFEB
  • 131
  • 1
  • 8
6
votes
2 answers

Sonarqube: Import Jacoco xml report for multimodule

I have a multimodule Maven project where the coverage reports are located in another module than the covered Java classes. An import of a not empty xml coverage report (with coverage information) into Sonarqube is successful but shows a coverage of…
Rokko_11
  • 837
  • 2
  • 10
  • 24
6
votes
1 answer

Java.lang.IllegalStateException: Failed to parse JaCoCo XML report: jacoco.exec

I am trying to publish my coverage report generated by Jacoco plugin - jacoco.exec. But I get the below exception with the mentioned sonar and Jacoco configuration. SonarCube version 6.7.7 [ERROR] Coverage report 'jacoco.exec' could not be…
6
votes
0 answers

Jacoco report aggregate shows 0 coverage even if tests were executed

My maven project directory structure is as follows: parent -child -src/java -src/test -pom.xml -integration_test -src/test -pom.xml -report -pom.xml -pom.xml Since integration tests and source…
6
votes
0 answers

Codecov : coverage and complexity rate

I'm testing a project and I use Codecov to publish the coverage rate of my tests. Codecov uses the report generated by Jacoco and so far it works fine. Codecov doesn't display only the coverage rates, but also the complexity rates of the tests. I…
Julien Berthoud
  • 721
  • 8
  • 24
6
votes
1 answer

Test failing when using JaCoCO

I'm trying to measure coverage using JaCoCo on this project: https://github.com/square/retrofit Everything seems to work fine but, for some reason, several tests that used to work, fail when using JaCoCo runtime agent. Here is (the interesting part)…
ttk203
  • 347
  • 5
  • 10
6
votes
2 answers

Sonar does not pick up Unit Tests Results even thought Code Coverage is generated

I am running SonarQuebe 6.2 on my local machine, I have Spring Boot Java 8 project with written unit tests that I want to upload to Sonar for static analysis all together with code coverage. Code coverage is generated - I have my JaCoCo HTML report,…
darekg11
  • 175
  • 1
  • 3
  • 13
6
votes
1 answer

jacoco:report-aggregate either gets shallow coverage or none at all

I have a large multi-module Maven build, presently with a mix of PowerMock and Mockito tests (moving all PowerMock tests to Mockito soon). The default jacoco-maven-plugin config in the parent pom is for "offline" instrumentation, but the one module…
David M. Karr
  • 14,317
  • 20
  • 94
  • 199
6
votes
0 answers

Excluded classes still counting towards total coverage result

We have recently upgraded to SonarCube 4.3.2. In he previous version (don't remember what it was) it was possible to select Jacoco as code coverage analyser and to define the excludes in Maven as a simple property; e.g.
Stijn Geukens
  • 15,454
  • 8
  • 66
  • 101
5
votes
0 answers

Jacoco Aggregate Report displays 0% Coverage

I am trying to add an aggregated coverage report for the unit tests for a multi-module project. The coverage report is generated as expected for individual modules. But the aggregated report generated in the report module target is showing coverage…
1 2
3
26 27