I'm trying to generate a coverage report with JMockit and the Maven Surefire plug-in. But nothing happens.

Here are the relevant parts of my pom.xml:

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.15</version>
    <configuration>
        <argLine>
            -Djmockit-coverage-outputDir=target/coverage-report
        </argLine>
    </configuration>
</plugin>

The jmockit dependency:

<dependency>
  <groupId>com.googlecode.jmockit</groupId>
  <artifactId>jmockit-coverage</artifactId>
  <version>0.999.22</version>
  <scope>runtime</scope>
</dependency>

This is pretty much the same as the example from the JMockit docs.

It should generate a report with mavens "test" goal, but it does not. I've tried "surefire:test" too, but nothing happens.

I'm using Java 7 and Maven 3.0.

How can I generate a JMockit coverage report with maven?

有帮助吗?

解决方案

You will need to also add the "jmockit" dependency, version 1.3 or newer (and before "junit" if that's the case).

The JMockit Coverage documentation is indeed missing this detail; should be fixed soon.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top