You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "KARR, DAVID" <dk...@att.com> on 2014/10/10 00:45:16 UTC

What is the minimum required config for the Maven Cobertura plugin to instrument, run, and generate xml and html reports?

I have a working configuration that runs unit tests with Cobertura using Maven.  I've always been a little mystified by Maven phases and how various plugins integrate with it (and I've read the user guide).

I'd like to understand the minimum required configuration to get Cobertura automatically running along with my unit tests, and generating both the XML and HTML outputs.  Answering this might require understanding what the Cobertura plugin goals do, but perhaps this is more of a Maven question.  I don't know.

For a long time, I had the following in the "executions" section:
---------------------------
    <executions>
        <execution>
            <id>prepare</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>clean</goal>
                <goal>check</goal>
            </goals>
        </execution>
        <execution>
            <id>package</id>
            <phase>package</phase>
            <goals>
                <goal>cobertura</goal>
            </goals>
        </execution>
    </executions>
---------------------------

This works, but I've always been unclear on exactly what is "required" and what is just fluff.  By "works", I mean that I see it instrument code, then run tests, and apparently generating output, because I find new versions of the XML and HTML reports after it completes.

Today I tried simplifying this to just the following:
-----------------------------
    <executions>
        <execution>
            <goals>
                <goal>clean</goal>
                <goal>check</goal>
                <goal>cobertura</goal>
            </goals>
        </execution>
    </executions>
-----------------------------

This also seems to work perfectly fine.  I just don't know if there's really any difference, or not.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org