o the front-end for surefire
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114648 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
63
surefire/src/main/org/apache/maven/test/SurefirePlugin.java
Normal file
63
surefire/src/main/org/apache/maven/test/SurefirePlugin.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package org.apache.maven.test;
|
||||
|
||||
import org.apache.maven.artifact.MavenArtifact;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.surefire.SurefireBooter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
*
|
||||
* @version $Id: SurefirePlugin.java,v 1.1 2004/02/01 21:06:09 jvanzyl Exp $
|
||||
*/
|
||||
public class SurefirePlugin
|
||||
{
|
||||
private MavenProject project;
|
||||
|
||||
public void setProject( MavenProject project )
|
||||
{
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception
|
||||
{
|
||||
String mavenRepoLocal = project.getProperty( "maven.repo.local" );
|
||||
|
||||
String basedir = project.getFile().getParentFile().getPath();
|
||||
|
||||
System.setProperty( "basedir", basedir );
|
||||
|
||||
List includes = project.getBuild().getUnitTest().getIncludes();
|
||||
|
||||
List excludes = project.getBuild().getUnitTest().getExcludes();
|
||||
|
||||
SurefireBooter surefireBooter = new SurefireBooter();
|
||||
|
||||
surefireBooter.addBattery( "org.codehaus.surefire.battery.DirectoryBattery", new Object[]{basedir, includes, excludes} );
|
||||
|
||||
surefireBooter.addClassPathUrl( new File( mavenRepoLocal, "junit/jars/junit-3.8.1.jar" ).getPath() );
|
||||
|
||||
surefireBooter.addClassPathUrl( new File( mavenRepoLocal, "surefire/jars/surefire-1.0.jar" ).getPath() );
|
||||
|
||||
surefireBooter.addClassPathUrl( new File( basedir, "target/classes" ).getPath() );
|
||||
|
||||
surefireBooter.addClassPathUrl( new File( basedir, "target/test-classes" ).getPath() );
|
||||
|
||||
for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); )
|
||||
{
|
||||
MavenArtifact artifact = (MavenArtifact) i.next();
|
||||
|
||||
surefireBooter.addClassPathUrl( artifact.getFile().getPath() );
|
||||
}
|
||||
|
||||
surefireBooter.addReport( "org.codehaus.surefire.report.ConsoleReport" );
|
||||
|
||||
surefireBooter.run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user