FAQ

This is a compilation of questions that have been asked by JaCoCo users before.

Does JaCoCo have a plug-in for [Eclipse|Netbeans|Whatever...]?

See this list for current integrations with various tools.

Why do I get the error "Can't add different class with same name"?

For coverage report generation all classes within a group must have unique names. You get this error during report generation if JaCoCo is supplied with multiple different class files with the same name. To fix this remove those duplicate classes or create separate reports or report groups for each version.

Why does the coverage report not show line coverage figures?

JaCoCo is based on class files analysis. To calculate line coverage class files must contain line number attributes. For this your code must be compiled with debug information.

Why does the coverage report coverage report not show highlighted source code?

Make sure the following prerequisites are fulfilled to get source code highlighting in JaCoCo coverage reports:

Why does a class show as not covered although it has been executed?

First make sure execution data has been collected. For this select the Sessions link on the top right corner of the HTML report and check whether the class in question is listed. If it is listed but not linked the class at execution time is a different class file. Make sure you're using the exact same class file at runtime as for report generation. Note that some tools (e.g. EJB containers, mocking frameworks) might modify your class files at runtime.

Why are Java interface types not shown in the coverage reports?

Java interface methods do not contain code, therefore code coverage cannot be evaluated. Indeed code coverage is recorded for the implementation classes. The same applies to abstract methods in abstract classes.

Can I collect coverage information without stopping the JVM?

The JaCoCo agent can be configured for remote control via TCP/IP sockets. This allows to collect execution data at any point in time from a running JVM. The dump Ant task can be used to request dumps. The remote control feature also allows you to reset execution data.