How to avoid double compilation and testing with cobertura: check?

I use maven-cobertura-plugin to calculate code coverage in my project. As far as I understand, this plugin launches a new forked build cycle to compile and test the code base. When this is done, the plugin calculates the coverage of the code. As far as I understand, this is the only approach the plugin can use, and this is good for me.

The problem is that before the cobertura plugin cobertura my code base has already been compiled and tested. Thus, I experience duplicate compilation and testing. Is it possible to avoid compiling and testing before cobertura ? Or maybe there is another way around this?

+4
source share
3 answers

Can compilation and testing be avoided before cobertura? Or maybe there is another way around this?

There are several questions about this (see MCOBERTURA-83 , MCOBERTURA-76 ), but AFAIK, there is no ideal workaround (due to how the life cycle was built) in Maven 3 can be improved.

The only thing I know (works with CI servers) will work:

 mvn clean install -Dmaven.test.skip=true 

and then

 mvn cobertura:check 

Instead of binding cobertura:check to the build life cycle.

Note that compiling twice should not be a problem, since all classes must be updated.

+1
source

As far as I know, cobertura needs to work with barcode in code in order to be able to work.

0
source

The only way I could work with was to process the byte code as part of my build (by linking the cobertura:instrument target to the cobertura:instrument phase, and also bind the default-test execution from the maven-surefire-plugin to the verify phase verify that it was not performed as part of the test phase each time the cobertura goal was cobertura .

0
source

All Articles