mirror of https://github.com/apache/maven.git
First pass at fixing MNG-1136. This is still not working as the jdk config property is not passed by the check mojo. Thus the jdk property is always null
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@327233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
402843facc
commit
62adbd1175
|
@ -26,6 +26,14 @@ public abstract class AbstractCloverMojo extends AbstractMojo
|
||||||
*/
|
*/
|
||||||
private String licenseFile;
|
private String licenseFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the Clover instrumentation should use the Clover <code>jdk14</code> or
|
||||||
|
* <code>jdk15<code> flags to parse sources.
|
||||||
|
*
|
||||||
|
* @parameter
|
||||||
|
*/
|
||||||
|
protected String jdk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the license file for Clover runtime by setting the
|
* Registers the license file for Clover runtime by setting the
|
||||||
* <code>clover.license.path</code> system property. If the <code>licenseFile</code>
|
* <code>clover.license.path</code> system property. If the <code>licenseFile</code>
|
||||||
|
|
|
@ -39,13 +39,13 @@ public class CloverCheckMojo
|
||||||
* @parameter expression="${project.build.directory}/clover/clover.db"
|
* @parameter expression="${project.build.directory}/clover/clover.db"
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
protected String cloverDatabase;
|
private String cloverDatabase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter default-value="70%"
|
* @parameter default-value="70%"
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
protected String targetPercentage;
|
private String targetPercentage;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -149,11 +150,47 @@ public class CloverInstrumentMojo
|
||||||
* @return the CLI args to be passed to CloverInstr
|
* @return the CLI args to be passed to CloverInstr
|
||||||
* @todo handle multiple source roots. At the moment only the first source root is instrumented
|
* @todo handle multiple source roots. At the moment only the first source root is instrumented
|
||||||
*/
|
*/
|
||||||
private String[] createCliArgs()
|
private String[] createCliArgs() throws MojoExecutionException
|
||||||
{
|
{
|
||||||
// TODO: Temporary while we wait for surefire to be able to fork unit tests. See
|
List parameters = new ArrayList();
|
||||||
// http://jira.codehaus.org/browse/MNG-441
|
|
||||||
return new String[]{"-p", "threaded", "-f", "100", "-i", this.cloverDatabase, "-s",
|
// TODO: The usage of the threaded flushpolicy model and a flush policy is temporary while
|
||||||
(String) this.project.getCompileSourceRoots().get( 0 ), "-d", this.cloverOutputSourceDirectory};
|
// we wait for surefire to be able to fork unit tests. See http://jira.codehaus.org/browse/MNG-441
|
||||||
|
|
||||||
|
parameters.add( "-p" );
|
||||||
|
parameters.add( "threaded" );
|
||||||
|
parameters.add( "-f" );
|
||||||
|
parameters.add( "100" );
|
||||||
|
|
||||||
|
parameters.add( "-i" );
|
||||||
|
parameters.add( this.cloverDatabase );
|
||||||
|
parameters.add( "-s" );
|
||||||
|
|
||||||
|
// TODO: Allow support for several source roots in the future.
|
||||||
|
parameters.add( (String) this.project.getCompileSourceRoots().get( 0 ) );
|
||||||
|
|
||||||
|
parameters.add( "-d" );
|
||||||
|
parameters.add( this.cloverOutputSourceDirectory );
|
||||||
|
|
||||||
|
if ( this.jdk != null )
|
||||||
|
{
|
||||||
|
if ( this.jdk.equals( "1.4" ) )
|
||||||
|
{
|
||||||
|
parameters.add( "-jdk14" );
|
||||||
|
}
|
||||||
|
else if ( this.jdk.equals( "1.5" ) )
|
||||||
|
{
|
||||||
|
parameters.add( "-jdk15" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException("Unsupported jdk version [" + this.jdk
|
||||||
|
+ "]. Valid values are [1.4] and [1.5]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getLog().debug( "Instrumenting using parameters [" + parameters.toString() + "]");
|
||||||
|
|
||||||
|
return (String[]) parameters.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue