I’m using maven-cobertura-plugin in order to calculate code coverage in my project. As I understand, this plugin starts a new/forked build cycle in order to compile and test the code base. When it’s done the plugin calculates code coverage. As I understand, this is the only approach the plugin can use, and it’s fine for me.
The problem is that before cobertura plugin my code base is compiled and tested already. Thus, I’m experiencing duplicated compilation and testing. Is it possible to avoid compilation and testing before cobertura? Or maybe there is some other workaround?
There are several issues about this (see MCOBERTURA-83, MCOBERTURA-76) but AFAIK, there is no perfect workaround (due to the way the life cycle is constructed – things might be improved in Maven 3).
The only one I’m aware of (works with CI servers) would be to run:
and then
Instead of binding
cobertura:checkon the build lifecycle.Note that compiling twice shouldn’t be an issue as all classes should be up to date.