Reputation: 437
I have a jacoco-agent generated file of my Maven project (Java), named jacoco.exec
.
How can I convert this file into human readable format? (HTML/XML).
Upvotes: 7
Views: 22132
Reputation: 4280
Godin's answer is perfect. But if you are using maven, then you can simply run the following command
mvn clean verify
As Jacoco's report goal is attached to the verify phase of maven life cycle.
mvn verify
would simply invoke the report
goal, and will generate all the reports in the following path
./target/site/jacoco
Upvotes: 1
Reputation: 686
In the Gradle world (for anyone who happened to stumble upon this question), use the JacocoReport
task, documented here.
The configured task would look something like this:
jacocoTestReport {
reports {
html.enabled = true
html.destination "${buildDirectory}/coverage/report/html"
xml.enabled = true
xml.destination "${buildDirectory}/coverage/report/xml"
}
executionData = files("path/to/jacoco.exec")
}
Upvotes: 6
Reputation: 10574
I believe that this is described in official JaCoCo documentation. In particular there is jacoco-maven-plugin goal "report" and example of its usage.
Starting from JaCoCo version 0.8.0 there is also Command Line interface. Here is an example of how to use it to produce HTML report from jacoco.exec
, note that this also requires class files:
java -jar jacoco-0.8.1/lib/jacococli.jar report jacoco.exec --classfiles directory_with_classes --html directory_for_report
Upvotes: 9