Using Clover via the maven-antrun-plugin
Any of Clover's Ant Tasks may be used directly from within Maven by using the maven-antrun-plugin.
Specifically, if you wanted to use the clover-check task to ensure that a particular package maintains a given coverage percentage, you could use the following configuration in Maven:
<profile>
<id>clover.check</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.atlassian.clover</groupId>
<artifactId>clover</artifactId>
<version>4.1.2</version> <!-- Ensure you use the same version as the clover-maven-plugin -->
</dependency>
</dependencies>
<executions>
<execution>
<phase>verify</phase>
<configuration>
<tasks>
<property name="clover.license.path" location="${user.home}/clover.license"/> <!-- Change this to point to your license -->
<taskdef resource="cloverlib.xml" classpathref="maven.plugin.classpath"/>
<clover-setup initString="${project.build.directory}/clover/clover.db"/>
<clover-check filter="${clover.filter}" haltOnFailure="true">
<package name="com.mypkg" target="100%"/> <!-- Check that com.mypkg always has 100% code coverage -->
</clover-check>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Last modified on Oct 12, 2016
Powered by Confluence and Scroll Viewport.