------ Maven 2 Clover Plugin: using ------ Vincent Massol ------ November 1st, 2005 Introduction The Clover plugin currently supports 2 features! * Generate a test coverage report by instrumenting your source files and then executing your tests. Your tests exercise your instrumented source code which in turn generate coverage logs to the {{{http://cenqua.com/clover/doc/adv/database.html}Clover database}}. This database is then used to generate a report. * Verify that your source code has a defined test coverage percentage and fail the build if it's below that level. This is the equivalent of the {{{http://cenqua.com/clover/doc/ant/checktask.html}Clover Check Ant task}}. Note that the Clover plugin will <> overwrite your main compiled classes nor your main test compiled tests classes. It creates a parallel directory in <<>> in order not to tamper with your main files. Generating the Clover report Make sure you add the Clover report in your <<>>: +-------- [...] [...] org.apache.maven.plugins maven-clover-plugin +--------- Then, to generate the report simply type <<>>. Checking test coverage In order to check for a test coverage percentage and fail the build in case of non-compliance, you'll need to configure the Clover plugin to tell it what threshold you wish to use: +-------- org.apache.maven.plugins maven-clover-plugin 50% check +--------- In this example we've also bound the <<>> goal to the <<>> phase which means it will be invoked automatically when calling <<>> on this project. Using Clover with JDK 1.4 and JDK 1.5 keywords If your code is using JDK 1.4 or JDK 1.5 specific keywords, you'll need to configure the Clover plugin. For example: +-------- org.apache.maven.plugins maven-clover-plugin 1.4 [...] +--------- Specifying a Clover flush policy If you want to specify the Clover {{{http://cenqua.com/clover/doc/adv/flushpolicies.html}flush policy}} that the plugin should use, then specify it in the plugin's configuration. Valid policies are <<>>, <<>> and <<>>. For example to use a <<>> policy with a flush interval of <<<5000>>> ms you would write: +-------- org.apache.maven.plugins maven-clover-plugin threaded 5000 [...] +---------