Cobertura's check goal should cause a Build Failure, not a Build Error
----------------------------------------------------------------------

                 Key: MCOBERTURA-64
                 URL: http://jira.codehaus.org/browse/MCOBERTURA-64
             Project: Maven 2.x Cobertura Plugin
          Issue Type: Bug
    Affects Versions: 2.1, 2.0
         Environment: winXP, linux
maven 2.0.4
            Reporter: Andre Rodrigues


I don't know if this is realy a bug, but...
When using the check goal with haltOnFailure set to true, cobertura should 
cause a Build Failure, not a Build Error. (the way checkstyle plugin does)

maven config (pom.xml)
{code:xml}
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <check>
            <haltOnFailure>true</haltOnFailure>
            <totalBranchRate>90</totalBranchRate>
            <totalLineRate>90</totalLineRate>
        </check>
    </configuration>
    <executions>
        <execution>
            <phase>test</phase>
                <goals>
                    <goal>check</goal>
                </goals>
            </execution>
    </executions>
</plugin>
{code}

I believe the problem is in the class 
org.codehaus.mojo.cobertura.tasks.CheckTask
{code:title=CheckTask.java|borderStyle=solid}
...
public void execute()
        throws MojoExecutionException {
    ...
    if ( config.isHaltOnFailure() )
    {
        throw new MojoExecutionException( "Coverage check failed. See messages 
above." );
    }
    ...
}
{code}

where I believe it should be: 
{code}
public void execute()
        throws MojoExecutionException,  MojoFailureException {
    ...
    if ( config.isHaltOnFailure() )
    {
        throw new MojoFailureException( "Coverage check failed. See messages 
above." );
    }
    ...
}
{code}

The way it is, I'm not able to generate the site when the line coverage (or 
branch coverage) rate is below 90%.

-- 
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