1

I recently tried to include cobertura plugin for our project. But I ran to a strange problem. Now, if I try to do this:

mvn clean package cobertura:check-integration-test

My project assembles just fine. But after deploy here is what I get as a message:

java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/LightClassmapListener

This happens, as I understand, because cobertura alters the bytecode of my classes. So, how should I proceed with making checks and building the code? Right now I come up with the following solution for teamcity:

First step runs cobertura:

mvn clean package cobertura:check-integration-test

After that second step runs the normal assembly:

mvn clean package

This seems to work, but it seems kind of strange, that I have to run the process of packaging twice (this takes double time), just in order to make a clean build with bytecode unaffected by cobertura plugin.

SPIRiT_1984
  • 2,717
  • 3
  • 29
  • 46

1 Answers1

0

If you use qualinsight-mojo-cobertura, your classes will backuped at instrumentation time, then restored at reporting time (which will in turn result in having non-instrumented classes in the generated package).

Between intrumentation and reporting you run your tests (be it UTs, ITs) as you want (unlike maven-cobertura-plugin, qualinsight-mojo-cobertura does not run tests). For more information, check the project page (especially the Maven phases the plugin is bound to by default.)

Kraal
  • 2,779
  • 1
  • 19
  • 36