Configuring the GMaven Plugin for Groovy Support in Maven 2 and 3
If you are using Clover-for-Maven 2 and 3 on Groovy code, you would typically need to define a
plugin element for the GMaven Plugin in your
As shown in the example definition below, the GMaven Plugin definition requires the Groovy dependency (
groovy-all). However, within this dependency, you must define a version of Groovy that Clover supports inside a
version sub-element. If you omit this
version element, the GMaven Plugin will default to using Groovy version 1.6.0, which is not compatible with Clover.
Use the clover:setup goal for Clover instrumentation in case you have generateStubs or generateTestStubs goal declared in GMaven plugin configuration.
In case you use clover:instrument a build will fail with an error message like:
A reason is that GMaven will generate stubs twice and will add /generated-sources/groovy-stubs source root for both the default build life cycle (/target) and the Clover's forked build life cycle (/target/clover) resulting in duplicated source files passed to the Maven compiler.
Setting the providerSelection
Remember to configure a providerSelection parameter. Otherwise build might fail with the following error: "org.apache.maven.lifecycle.LifecycleExecutionException: Unexpected node: Node[7:1,64,ANNOTATIONS]" (see stackoverflow).
See https://bitbucket.org/atlassian/maven-clover2-plugin repository, src/it/groovy directory.