Command Line Interface
JaCoCo comes with a command line interface to perform
basic operations from the command line. The command line
tools with all dependencies are packaged in
jacococli.jar
and are available with the
JaCoCo download. Java 1.5 or greater is required for
execution.
For more sophisticated usage especially with larger projects please use our integrations with various build tools.
The following commands are available. Each command has a list of optional and required parameters. Some parameters can be specified multiple times to provide multiple values.
Warning:
Although a
instrument
command
is provided the preferred way for code coverage analysis
with JaCoCo is on-the-fly instrumentation with the
JaCoCo agent
. Offline
instrumentation has several drawbacks and should only be
used if a specific scenario explicitly requires this mode.
Please consult
documentation
about offline instrumentation before using this mode.
dump
java -jar jacococli.jar dump [--address <address>] --destfile <path> [--help] [--port <port>] [--quiet] [--reset] [--retry <count>]
Request execution data from a JaCoCo agent running in 'tcpserver' output mode.
Option | Description | Required | Multiple |
--address <address>
|
host name or ip address to connect to (default localhost) | ||
--destfile <path>
|
file to write execution data to | ◼ | |
--help
|
show help | ||
--port <port>
|
the port to connect to (default 6300) | ||
--quiet
|
suppress all output on stdout | ||
--reset
|
reset execution data on test target after dump | ||
--retry <count>
|
number of retries (default 10) |
instrument
java -jar jacococli.jar instrument [<sourcefiles> ...] --dest <dir> [--help] [--quiet]
Off-line instrumentation of Java class files and JAR files.
Option | Description | Required | Multiple |
<sourcefiles>
|
list of folder or files to instrument recusively | ◼ | |
--dest <dir>
|
path to write instrumented Java classes to | ◼ | |
--help
|
show help | ||
--quiet
|
suppress all output on stdout |
merge
java -jar jacococli.jar merge [<execfiles> ...] --destfile <path> [--help] [--quiet]
Merges multiple exec files into a new one.
Option | Description | Required | Multiple |
<execfiles>
|
list of JaCoCo *.exec files to read | ◼ | |
--destfile <path>
|
file to write merged execution data to | ◼ | |
--help
|
show help | ||
--quiet
|
suppress all output on stdout |
report
java -jar jacococli.jar report [<execfiles> ...] --classfiles <path> [--csv <file>] [--encoding <charset>] [--help] [--html <dir>] [--name <name>] [--quiet] [--sourcefiles <path>] [--tabwith <n>] [--xml <file>]
Generate reports in different formats by reading exec and Java class files.
Option | Description | Required | Multiple |
<execfiles>
|
list of JaCoCo *.exec files to read | ◼ | |
--classfiles <path>
|
location of Java class files | ◼ | ◼ |
--csv <file>
|
output file for the CSV report | ||
--encoding <charset>
|
source file encoding (by default platform encoding is used) | ||
--help
|
show help | ||
--html <dir>
|
output directory for the HTML report | ||
--name <name>
|
name used for this report | ||
--quiet
|
suppress all output on stdout | ||
--sourcefiles <path>
|
location of the source files | ◼ | |
--tabwith <n>
|
tab stop width for the source pages (default 4) | ||
--xml <file>
|
output file for the XML report |
classinfo
java -jar jacococli.jar classinfo [<classlocations> ...] [--help] [--quiet] [--verbose]
Print information about Java class files at the provided location.
Option | Description | Required | Multiple |
<classlocations>
|
location of Java class files | ◼ | |
--help
|
show help | ||
--quiet
|
suppress all output on stdout | ||
--verbose
|
show method and line number details |
execinfo
java -jar jacococli.jar execinfo [<execfiles> ...] [--help] [--quiet]
Print exec file content in human readable format.
Option | Description | Required | Multiple |
<execfiles>
|
list of JaCoCo *.exec files to read | ◼ | |
--help
|
show help | ||
--quiet
|
suppress all output on stdout |
version
java -jar jacococli.jar version [--help] [--quiet]
Print JaCoCo version information.
Option | Description | Required | Multiple |
--help
|
show help | ||
--quiet
|
suppress all output on stdout |