Add a new "report" goal
-----------------------

                 Key: MCOBERTURA-121
                 URL: http://jira.codehaus.org/browse/MCOBERTURA-121
             Project: Maven 2.x Cobertura Plugin
          Issue Type: New Feature
    Affects Versions: 2.3
            Reporter: Frank Pavageau


It would be useful to have a "report" goal in the plugin, to be able to 
completely manage the lifecycle of the coverage.

I've run into the problem described in MCOBERTURA-80 and found a workaround 
which could be greatly simplified by the introduction of this goal. I run 
cobertura during the integration phase, instead of the test phase, and avoid 
the recompilation (both compile:compile and aspect:compile) that happens in the 
forked lifecycle of the cobertura goal:
{code:xml}
<build>
    <plugins>
        <!-- Other plugins invoked in earlier phases of the lifecycle -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>cobertura-instrument</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>instrument</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
                <execution>
                    <id>cobertura-test</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <!--
          - Since there is no report goal in cobertura-maven-plugin, I have to 
invoke
          - cobertura itself manually, which is not pretty...
        -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1.1</version>
            <dependencies>
                <dependency>
                    <groupId>net.sourceforge.cobertura</groupId>
                    <artifactId>cobertura</artifactId>
                    <version>1.9.2</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>cobertura-report</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        
<mainClass>net.sourceforge.cobertura.reporting.Main</mainClass>
                        <arguments>
                            <argument>--datafile</argument>
                            
<argument>${project.build.directory}/cobertura/cobertura.ser</argument>
                            <argument>--destination</argument>
                            
<argument>${project.build.directory}/cobertura</argument>
                            <argument>--format</argument>
                            <argument>xml</argument>
                        </arguments>
                        
<includeProjectDependencies>false</includeProjectDependencies>
                        
<includePluginDependencies>true</includePluginDependencies>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
{code}

The last bit would then become:
{code:xml}
<build>
    <plugins>
        <!-- ... -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>cobertura-instrument</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
{code}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to