PR: MNG-298

Submitted by: Vincent Massol
Reviewed by:  Brett Porter
set some system properties based on plugin configuration. At this point, they are not reverted afterwards...

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169497 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-05-10 16:53:59 +00:00
parent 1338b5d537
commit f0248e0084
1 changed files with 18 additions and 0 deletions

View File

@ -26,8 +26,10 @@ import org.codehaus.surefire.SurefireBooter;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
/** /**
@ -98,6 +100,13 @@ public class SurefirePlugin
*/ */
private ArtifactRepository localRepository; private ArtifactRepository localRepository;
/**
* List of System properties to pass to the JUnit tests.
*
* @parameter
*/
private Properties systemProperties;
public void execute() public void execute()
throws MojoExecutionException throws MojoExecutionException
{ {
@ -158,6 +167,15 @@ public class SurefirePlugin
System.setProperty( "basedir", basedir ); System.setProperty( "basedir", basedir );
// Add all system properties configured by the user
Enumeration propertyKeys = systemProperties.propertyNames();
while ( propertyKeys.hasMoreElements() )
{
String key = (String) propertyKeys.nextElement();
System.setProperty( key, systemProperties.getProperty( key ) );
getLog().debug( "Setting system property [" + key + "]=[" + systemProperties.getProperty( key ) + "]" );
}
// TODO: we should really just trust the plugin classloader? // TODO: we should really just trust the plugin classloader?
try try
{ {