You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vm...@apache.org on 2006/05/18 09:45:22 UTC
svn commit: r407486 - in /maven/plugins/trunk/maven-clover-plugin/src:
it/multiproject/pom.xml
main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
Author: vmassol
Date: Thu May 18 00:45:21 2006
New Revision: 407486
URL: http://svn.apache.org/viewvc?rev=407486&view=rev
Log:
MCLOVER-41: clover:check should check all Clover databases it can find
Modified:
maven/plugins/trunk/maven-clover-plugin/src/it/multiproject/pom.xml
maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
Modified: maven/plugins/trunk/maven-clover-plugin/src/it/multiproject/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clover-plugin/src/it/multiproject/pom.xml?rev=407486&r1=407485&r2=407486&view=diff
==============================================================================
--- maven/plugins/trunk/maven-clover-plugin/src/it/multiproject/pom.xml (original)
+++ maven/plugins/trunk/maven-clover-plugin/src/it/multiproject/pom.xml Thu May 18 00:45:21 2006
@@ -29,7 +29,7 @@
<configuration>
<flushPolicy>threaded</flushPolicy>
<flushInterval>100</flushInterval>
- <targetPercentage>1%</targetPercentage>
+ <targetPercentage>25%</targetPercentage>
</configuration>
<executions>
<execution>
@@ -37,6 +37,7 @@
<phase>verify</phase>
<goals>
<goal>instrument</goal>
+ <goal>aggregate</goal>
<goal>check</goal>
</goals>
</execution>
Modified: maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java?rev=407486&r1=407485&r2=407486&view=diff
==============================================================================
--- maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java (original)
+++ maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java Thu May 18 00:45:21 2006
@@ -22,9 +22,11 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import java.io.File;
+
/**
* Verify test percentage coverage from an existing Clover database and fail the build if it is below the defined
- * threshold.
+ * threshold. The check is done on main Clover databases and also on merged Clover databases when they exist.
*
* @goal check
* @phase verify
@@ -66,12 +68,24 @@
private void check() throws MojoExecutionException
{
+ if ( new File( getCloverDatabase() ).exists() )
+ {
+ checkDatabase( getCloverDatabase() );
+ }
+ if ( new File( getCloverMergeDatabase() ).exists() )
+ {
+ checkDatabase( getCloverMergeDatabase() );
+ }
+ }
+
+ private void checkDatabase(String database) throws MojoExecutionException
+ {
Project antProject = registerCloverAntTasks();
- getLog().info( "Checking for coverage of " + targetPercentage);
+ getLog().info( "Checking for coverage of [" + targetPercentage + "] for database [" + database + "]");
CloverPassTask cloverPassTask = (CloverPassTask) antProject.createTask( "clover-check" );
- cloverPassTask.setInitString( getCloverDatabase() );
+ cloverPassTask.setInitString( database );
cloverPassTask.setHaltOnFailure( true );
cloverPassTask.setTarget( new Percentage( this.targetPercentage ) );
cloverPassTask.setFailureProperty( "clovercheckproperty" );
@@ -85,6 +99,7 @@
getLog().error( antProject.getProperty( "clovercheckproperty" ) );
throw new MojoExecutionException( e.getMessage(), e );
}
+
}
private boolean isInCloverForkedLifecycle()