Author: vmassol Date: Thu May 18 04:16:36 2006 New Revision: 407525 URL: http://svn.apache.org/viewvc?rev=407525&view=rev Log: MCLOVER-39: clover:check and clover:log should ignore projects with no Clover database rather than error out MCLOVER-41: clover:check and clover:log should operate on all Clover databases
I had forgotten to implement it for the clover:logo goal in my previous commit so here it is... Modified: maven/plugins/trunk/maven-clover-plugin/src/it/multiproject/pom.xml maven/plugins/trunk/maven-clover-plugin/src/it/simple/pom.xml maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverLogMojo.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=407525&r1=407524&r2=407525&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 04:16:36 2006 @@ -39,6 +39,7 @@ <goal>instrument</goal> <goal>aggregate</goal> <goal>check</goal> + <goal>log</goal> </goals> </execution> <execution> Modified: maven/plugins/trunk/maven-clover-plugin/src/it/simple/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clover-plugin/src/it/simple/pom.xml?rev=407525&r1=407524&r2=407525&view=diff ============================================================================== --- maven/plugins/trunk/maven-clover-plugin/src/it/simple/pom.xml (original) +++ maven/plugins/trunk/maven-clover-plugin/src/it/simple/pom.xml Thu May 18 04:16:36 2006 @@ -49,6 +49,15 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clover-plugin</artifactId> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + </dependency> + </dependencies> + <configuration> <targetPercentage>1%</targetPercentage> Modified: maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverLogMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverLogMojo.java?rev=407525&r1=407524&r2=407525&view=diff ============================================================================== --- maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverLogMojo.java (original) +++ maven/plugins/trunk/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverLogMojo.java Thu May 18 04:16:36 2006 @@ -20,6 +20,8 @@ import org.apache.maven.plugin.clover.internal.AbstractCloverMojo; import org.apache.tools.ant.Project; +import java.io.File; + /** * Provides information on the current Clover database. * @@ -35,12 +37,46 @@ public void execute() throws MojoExecutionException { - super.execute(); + if ( areCloverDatabasesAvailable() ) + { + super.execute(); + + AbstractCloverMojo.waitForFlush( getWaitForFlush(), getFlushInterval() ); + + log(); + } + else + { + getLog().info("No Clover database found, skipping Clover database logging"); + } + } + + /** + * Log information for both the main Clover database and the merged Clover database when they exist. + */ + private void log() + { + if ( new File( getCloverDatabase() ).exists() ) + { + logDatabase( getCloverDatabase() ); + } + if ( new File( getCloverMergeDatabase() ).exists() ) + { + logDatabase( getCloverMergeDatabase() ); + } + } + /** + * Log information from a Clover database. + * + * @param database the Clover database to log + */ + private void logDatabase(String database) + { Project antProject = registerCloverAntTasks(); CloverLogTask cloverLogTask = (CloverLogTask) antProject.createTask( "clover-log" ); - cloverLogTask.setInitString( getCloverDatabase() ); + cloverLogTask.setInitString( database ); cloverLogTask.setOutputProperty( "cloverlogproperty" ); cloverLogTask.execute();