I have some unit tests (although they're Android tests, I'm using Robolectric, so they're running on the JVM). They run happily without coverage.
I'm getting this error from emma-maven when I try it with coverage:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument (default-cli) on project android: Execution default-cli of goal org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3:instrument failed: class [com.larvalabs.svgandroid.ParserHelper] appears to be instrumented already
The important bit is class .... appears to be instrumented already.
It's very hard to find proper documentation, but this is what I've cobbled together for the configuration from various sources:
<plugin>
<!-- This doesn't work, see below for a working configuration -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
<inherited>true</inherited>
<executions>
<execution>
<phase>process-classes</phase>
<configuration>
<filters>
<filter>-com.viewpagerindicator.*</filter>
<filter>-com.actionbarsherlock.*</filter>
<filter>-com.larvalabs.svgandroid.*</filter>
</filters>
</configuration>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
The trouble is, having excluded those packages it was complaining about (I thought the issue was that these are Android library-projects inadvertently ending up twice on some list of paths), it's now complaining about my own packages.
A colleague incorrectly suggested the <plugin> section above should go in <project><build><pluginManagement>.
It turns out that the <configuration> should be directly in <plugin> and the leftover <executions> bit should be removed, see answer.