javacode-coverageinstrumentationcoberturamaven-cobertura-plugin

Goal "cobertura:instrument" in Cobertura Maven Plugin


What might be some real use case to invoke cobertura:instrument goal from Cobertura Maven Plugin?

I know that it just instruments classes, but when it may be preferred over cobertura:cobertura or cobertura:check?


Solution

  • This goal can be needed for instance for integration tests. If I make a parallel with what I'm doing with qualinsight-mojo-cobertura-core (an alternative mojo to cobertura-maven-plugin), having a separate goal for instrumentation allows you to plug other actions between code instrumentation and coverage report generation.

    For instance, if you take this pom.xml example, you'll see that:

    Without having two separate goals for instrumentation and report generation, this would'nt be possible. Side note: cobertura:cobertura also executes tests, it's an all in one goal.