This documentation assumes you have already set up your Maven project and created unit tests.
Using the Clover-for-Maven plugin
There are three possible ways of running the plugin:
- All in one: You'll either call the clover goal or add the
maven-clover-pluginreport to the reports section in your POM. This will instrument your source code, run your project's tests on the 'cloverified' code and generate Clover reports. Note that if you're in a multi-project environment, you must set themaven.clover.multiprojectproperty to 'true' in your master project. Doing so will automatically gather Clover data from all of your sub-projects, and aggregate them in a master project report. - In two steps: You'll call
clover:testwhich will instrument your source code and run your project's tests on the 'cloverified' code. Alternatively you can callclover:multiprojectto run theclover:testgoal on all your sub-projects in you're in a multi-project environment. You'll then need to callclover:reportto generate the reports. - In three steps: You'll call
clover:onfollowed by whatever other goal you wish. For example:This will instrument your source code. Then you'll run any goal that tests your artifacts. For example, in the case of a WAR you can use HttpUnit/HtmlUnit to run functional tests. The test of your artifact will fill the Clover database with data. Finally you'll runmaven clover:on war
clover:reportto generate the reports.