Percentage is a string with a percent symbol.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226509 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Massol 2005-07-30 13:23:01 +00:00
parent 3f9d1efdbf
commit 31bb2440b9
1 changed files with 6 additions and 5 deletions

View File

@ -17,6 +17,7 @@ package org.apache.maven.plugin.clover;
*/ */
import com.cenqua.clover.cfg.Percentage; import com.cenqua.clover.cfg.Percentage;
import com.cenqua.clover.cfg.Interval;
import com.cenqua.clover.tasks.CloverPassTask; import com.cenqua.clover.tasks.CloverPassTask;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@ -43,30 +44,30 @@ public class CloverCheckMojo
protected String cloverDatabase; protected String cloverDatabase;
/** /**
* @parameter default-value="70" * @parameter default-value="70%"
* @required * @required
*/ */
protected float targetPercentage; protected String targetPercentage;
public void execute() public void execute()
throws MojoExecutionException throws MojoExecutionException
{ {
Project antProject = registerCloverAntTasks(); Project antProject = registerCloverAntTasks();
getLog().info( "Checking for coverage of " + targetPercentage + "%" ); getLog().info( "Checking for coverage of " + targetPercentage);
CloverPassTask cloverPassTask = (CloverPassTask) antProject.createTask( "clover-check" ); CloverPassTask cloverPassTask = (CloverPassTask) antProject.createTask( "clover-check" );
cloverPassTask.setInitString( this.cloverDatabase ); cloverPassTask.setInitString( this.cloverDatabase );
cloverPassTask.setHaltOnFailure( true ); cloverPassTask.setHaltOnFailure( true );
cloverPassTask.setTarget( new Percentage( this.targetPercentage ) ); cloverPassTask.setTarget( new Percentage( this.targetPercentage ) );
cloverPassTask.setFailureProperty("clovercheckproperty"); cloverPassTask.setFailureProperty( "clovercheckproperty" );
try try
{ {
cloverPassTask.execute(); cloverPassTask.execute();
} }
catch ( BuildException e ) catch ( BuildException e )
{ {
getLog().error( antProject.getProperty("clovercheckproperty") ); getLog().error( antProject.getProperty( "clovercheckproperty" ) );
throw new MojoExecutionException( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e );
} }
} }