mirror of https://github.com/apache/maven.git
some tidying up
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d56d3de13d
commit
15a6120bde
|
@ -19,8 +19,8 @@ package org.apache.maven.plugin.clover;
|
|||
import com.cenqua.clover.cfg.Percentage;
|
||||
import com.cenqua.clover.tasks.CloverPassTask;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Taskdef;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ public class CloverCheckMojo
|
|||
protected String cloverDatabase;
|
||||
|
||||
/**
|
||||
* @parameter expression="70"
|
||||
* @parameter default-value="70"
|
||||
* @required
|
||||
*/
|
||||
protected float targetPercentage;
|
||||
|
@ -70,6 +70,8 @@ public class CloverCheckMojo
|
|||
|
||||
registerCloverAntTasks( antProject );
|
||||
|
||||
getLog().info( "Checking for coverage of " + targetPercentage + "%" );
|
||||
|
||||
CloverPassTask cloverPassTask = (CloverPassTask) antProject.createTask( "clover-check" );
|
||||
cloverPassTask.setInitString( this.cloverDatabase );
|
||||
cloverPassTask.setHaltOnFailure( true );
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.apache.maven.plugin.clover;
|
||||
|
||||
/*
|
||||
* Copyright 2005 The Apache Software Foundation.
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -13,36 +15,35 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.maven.plugin.clover;
|
||||
|
||||
import com.cenqua.clover.reporters.html.HtmlReporter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.AbstractMavenReport;
|
||||
import org.apache.maven.reporting.MavenReportException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.cenqua.clover.reporters.html.HtmlReporter;
|
||||
|
||||
/**
|
||||
* @goal report
|
||||
* @execute phase="test" lifecycle="clover"
|
||||
* @description Generate a Clover report
|
||||
*
|
||||
* Generate a Clover report.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
* @version $Id$
|
||||
* @goal report
|
||||
* @execute phase="test" lifecycle="clover"
|
||||
*/
|
||||
public class CloverReportMojo extends AbstractMavenReport
|
||||
public class CloverReportMojo
|
||||
extends AbstractMavenReport
|
||||
{
|
||||
/**
|
||||
* @parameter
|
||||
* @parameter expression="${project.build.directory}/clover/clover.db"
|
||||
* @required
|
||||
*/
|
||||
private String cloverDatabase;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}/site"
|
||||
* @parameter expression="${project.build.directory}/site/clover"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
@ -67,10 +68,10 @@ public class CloverReportMojo extends AbstractMavenReport
|
|||
public void executeReport( Locale locale )
|
||||
throws MavenReportException
|
||||
{
|
||||
int result = HtmlReporter.mainImpl(createCliArgs());
|
||||
if (result != 0)
|
||||
int result = HtmlReporter.mainImpl( createCliArgs() );
|
||||
if ( result != 0 )
|
||||
{
|
||||
throw new MavenReportException("Clover has failed to instrument the source files");
|
||||
throw new MavenReportException( "Clover has failed to instrument the source files" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,14 +81,8 @@ public class CloverReportMojo extends AbstractMavenReport
|
|||
*/
|
||||
private String[] createCliArgs()
|
||||
{
|
||||
String [] cliArgs = {
|
||||
|
||||
"-t", "Maven Clover report",
|
||||
"-p", (String) this.project.getCompileSourceRoots().get(0),
|
||||
"-i", this.cloverDatabase,
|
||||
"-o", this.outputDirectory };
|
||||
|
||||
return cliArgs;
|
||||
return new String[]{"-t", "Maven Clover report", "-p", (String) this.project.getCompileSourceRoots().get( 0 ),
|
||||
"-i", this.cloverDatabase, "-o", this.outputDirectory};
|
||||
}
|
||||
|
||||
public String getOutputName()
|
||||
|
@ -105,7 +100,7 @@ public class CloverReportMojo extends AbstractMavenReport
|
|||
|
||||
private static ResourceBundle getBundle( Locale locale )
|
||||
{
|
||||
return ResourceBundle.getBundle("clover-report", locale, CloverReportMojo.class.getClassLoader() );
|
||||
return ResourceBundle.getBundle( "clover-report", locale, CloverReportMojo.class.getClassLoader() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue