Jan 20, 2017

[memo] How to use jacoco

Here is my configuration of pom.xml

"jacoco-initialize" prepare jacoco-agent before "test" maven lifecycle. And "jacoco-site" export report in "package" maven lifecyccle phase.

mvn clean package
You can see the report in ${your_project_root_directory}/target/site/jacoco/index.html

I learned how to use jacoco from here.

If you use maven-surefire-plugin and argLine, you would see "Skipping JaCoCo execution due to missing execution data file......" message and failed to create report. Please refer the official document of jacoco.

If your project already defines VM arguments for test execution, be sure that they will include property defined by JaCoCo.
One of the ways to do this in case of maven-surefire-plugin - is to use syntax for late property evaluation:


@{argLine} -your -extra -arguments

Here is my real configuration pom.xml
Post a Comment