I have been looking to generate a code coverage report from the jar build file, with jacoco.
I found this command
java -jar jacococli.jar dump [--address <address>] --destfile <path> [--help] [--port <port>] [--quiet] [--reset] [--retry <count>]
to make it work but have no idea how to generate jacococli.jar .
I normally added as dependency but nothing happened.
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.cli</artifactId>
<version>0.8.3</version>
</dependency>
</dependencies>
I found this command
java -jar jacococli.jar dump [--address <address>] --destfile <path> [--help] [--port <port>] [--quiet] [--reset] [--retry <count>]
... added as dependecy but nothing happened
jacococli.jar
is not intended to be used as a dependency - command is shown in JaCoCo documentation on page https://www.jacoco.org/jacoco/trunk/doc/cli.html
which states
JaCoCo comes with a command line interface to perform basic operations from the command line.
and later also states
For more sophisticated usage especially with larger projects please use our integrations with various build tools.
among integrations there is jacoco-maven-plugin
for generation of report using Maven, documentation of this plugin available on page https://www.jacoco.org/jacoco/trunk/doc/maven.html
To use jacococli.jar
for generation of report from jacoco.exec
file for your.jar
file
zip
distribution of JaCoCo from https://www.jacoco.org/jacoco/jacoco
, jacococli.jar
will be in jacoco/lib/jacococli.jar
java -jar lib/jacococli.jar report path/to/jacoco.exec --classfiles path/to/your.jar --html path/for/report
path/for/report