1, Instrument
::Off-line instrumentation of Java class files and JAR files.
::set path=D:\Java\jdk1.6.0_34\bin
set path=D:\Java\jdk1.8.0_131\bin
java -jar jacococli.jar instrument D:\Git_Software\Server\6.2-spring2.5\standalone\deployments\biz-rds.jar --dest classes
pause
2, Dump
::Request execution data from a JaCoCo agent running in 'tcpserver' output mode.
pause
::set path=D:\Java\jdk1.6.0_34\bin
set path=D:\Java\jdk1.8.0_131\bin
java -jar jacococli.jar dump --address localhost --destfile test.exec
pause
3, Merge
::Merges multiple exec files into a new one.
::set path=D:\Java\jdk1.6.0_34\bin
set path=D:\Java\jdk1.8.0_131\bin
java -jar jacococli.jar merge *.exec --destfile merge/all.exec
pause
4, Report
::Generate reports in different formats by reading exec and Java class files.
::set path=D:\Java\jdk1.6.0_34\bin
set path=D:\Java\jdk1.8.0_131\bin
java -jar jacococli.jar report test.exec --classfiles D:\Git_Software\Server\6.2-spring2.5\standalone\deployments\biz-rds.jar --html report.html --sourcefiles E:\workspace4.3ForSNXGit\biz-rds\src\main\java
pause
5, Exec Info
::Print exec file content in human readable format.
::set path=D:\Java\jdk1.6.0_34\bin
set path=D:\Java\jdk1.8.0_131\bin
java -jar jacococli.jar execinfo *.exec
pause
Jacoco Command Line Interface(cli) Doc Reference (https://www.jacoco.org/jacoco/):
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 ] --destfile[--help] [--port ] [--quiet] [--reset] [--retry ]
Request execution data from a JaCoCo agent running in 'tcpserver' output mode.
Option | Description | Required | Multiple |
--address |
host name or ip address to connect to (default localhost) | ||
--destfile |
file to write execution data to | ◼ | |
--help |
show help | ||
--port |
the port to connect to (default 6300) | ||
--quiet |
suppress all output on stdout | ||
--reset |
reset execution data on test target after dump | ||
--retry |
number of retries (default 10) |
instrument
java -jar jacococli.jar instrument [...] --dest [--help] [--quiet]
Off-line instrumentation of Java class files and JAR files.
Option | Description | Required | Multiple |
|
list of folder or files to instrument recusively | ◼ | |
--dest |
path to write instrumented Java classes to | ◼ | |
--help |
show help | ||
--quiet |
suppress all output on stdout |
merge
java -jar jacococli.jar merge [...] --destfile [--help] [--quiet]
Merges multiple exec files into a new one.
Option | Description | Required | Multiple |
|
list of JaCoCo *.exec files to read | ◼ | |
--destfile |
file to write merged execution data to | ◼ | |
--help |
show help | ||
--quiet |
suppress all output on stdout |
report
java -jar jacococli.jar report [...] --classfiles [--csv ] [--encoding ] [--help] [--html ] [--name ] [--quiet] [--sourcefiles ] [--tabwith ] [--xml ]
Generate reports in different formats by reading exec and Java class files.
Option | Description | Required | Multiple |
|
list of JaCoCo *.exec files to read | ◼ | |
--classfiles |
location of Java class files | ◼ | ◼ |
--csv |
output file for the CSV report | ||
--encoding |
source file encoding (by default platform encoding is used) | ||
--help |
show help | ||
--html |
output directory for the HTML report | ||
--name |
name used for this report | ||
--quiet |
suppress all output on stdout | ||
--sourcefiles |
location of the source files | ◼ | |
--tabwith |
tab stop width for the source pages (default 4) | ||
--xml |
output file for the XML report |
classinfo
java -jar jacococli.jar classinfo [...] [--help] [--quiet] [--verbose]
Print information about Java class files at the provided location.
Option | Description | Required | Multiple |
|
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 [...] [--help] [--quiet]
Print exec file content in human readable format.
Option | Description | Required | Multiple |
|
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 |