<version>2.2</version> <!-- use last version available -->
Finally, to get the actual report, you must remember to run ‘mvn site’. The reports will *not* be generated when simply running the unit tests.
For configuration, you must add a <plugin> tag in <build><plugins>; this is optional if you are only interested in Maven Site Reports. Remember: this does *not* mean that coverage analysis will be done when testing or running the code, only when running “mvn site”.
If you want the coverage reports directly under Hudson (and are not satisfied with publishing the maven site reports), things gets messy. There is a plugin for this, but I couldn’t get it to work (some people report that the current version, v0.8.4, is broken; it could also be because I’m using a Maven 2-type job under Hudson, which is not the most stable)
First, install the Cobertura-Hudson plugin.
This plugin requires XML reports to be generated by Cobertura. Looks simple enough according to the documentation.
The wiki page for the Cobertura plugin states that the configuration should be done in the <build> tag, but that didn’t work for me. In my case, I had to do it in the <reporting> tag, as follows:
That’s it from me. I hope you’ll have more luck than me with the Cobertura plugin. Anyway, don’t forget that you can always look for the report on the Maven-generated site. You can even create a Bookmark to it, since the page is stable (except when the build overrides it, of course).