[MNG-4335] [regression] <settings><offline>true</offline</settings> is not honored

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@811352 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-09-04 11:41:49 +00:00
parent d7e8f29509
commit 08cc074b50
11 changed files with 265 additions and 279 deletions

View File

@ -29,7 +29,6 @@ import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.wagon.events.TransferListener;
/**
@ -264,7 +263,7 @@ public class DefaultMavenExecutionRequest
return interactiveMode;
}
public void setActiveProfiles( List<String> activeProfiles )
public MavenExecutionRequest setActiveProfiles( List<String> activeProfiles )
{
if ( activeProfiles != null )
{
@ -274,9 +273,11 @@ public class DefaultMavenExecutionRequest
{
this.activeProfiles = null;
}
return this;
}
public void setInactiveProfiles( List<String> inactiveProfiles )
public MavenExecutionRequest setInactiveProfiles( List<String> inactiveProfiles )
{
if ( inactiveProfiles != null )
{
@ -286,6 +287,8 @@ public class DefaultMavenExecutionRequest
{
this.inactiveProfiles = null;
}
return this;
}
public MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
@ -429,7 +432,7 @@ public class DefaultMavenExecutionRequest
public MavenExecutionRequest setLocalRepositoryPath( String localRepository )
{
localRepositoryPath = new File( localRepository );
localRepositoryPath = ( localRepository != null ) ? new File( localRepository ) : null;
return this;
}
@ -837,23 +840,9 @@ public class DefaultMavenExecutionRequest
return this;
}
private Settings settings;
// calculated from request attributes.
private ProjectBuildingRequest projectBuildingRequest;
public MavenExecutionRequest setSettings( Settings settings )
{
this.settings = settings;
return this;
}
public Settings getSettings()
{
return settings;
}
public boolean isProjectPresent()
{
return isProjectPresent;

View File

@ -32,7 +32,6 @@ import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.wagon.events.TransferListener;
import org.codehaus.plexus.logging.Logger;
@ -204,9 +203,11 @@ public interface MavenExecutionRequest
MavenExecutionRequest setProfiles( List<Profile> profiles );
MavenExecutionRequest addActiveProfile( String profile );
MavenExecutionRequest addActiveProfiles( List<String> profiles );
MavenExecutionRequest setActiveProfiles( List<String> profiles );
List<String> getActiveProfiles();
MavenExecutionRequest addInactiveProfile( String profile );
MavenExecutionRequest addInactiveProfiles( List<String> profiles );
MavenExecutionRequest setInactiveProfiles( List<String> profiles );
List<String> getInactiveProfiles();
// Proxies
@ -233,10 +234,6 @@ public interface MavenExecutionRequest
boolean isUsePluginUpdateOverride();
MavenExecutionRequest setUsePluginUpdateOverride( boolean usePluginUpdateOverride );
// Setting
Settings getSettings();
MavenExecutionRequest setSettings( Settings settings );
boolean isProjectPresent();
MavenExecutionRequest setProjectPresent( boolean isProjectPresent );

View File

@ -19,6 +19,7 @@ package org.apache.maven.execution;
* under the License.
*/
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.settings.Mirror;
@ -94,7 +95,7 @@ class SettingsAdapter
@Override
public List<Profile> getProfiles()
{
return request.getSettings().getProfiles();
return new ArrayList<Profile>();
}
@Override

View File

@ -32,7 +32,6 @@ import org.apache.commons.cli.CommandLine;
import org.apache.maven.Maven;
import org.apache.maven.MavenTransferListener;
import org.apache.maven.embedder.MavenEmbedder;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
@ -44,18 +43,27 @@ final class CLIRequestUtils
{
}
public static MavenExecutionRequest buildRequest( CommandLine commandLine, boolean debug, boolean quiet, boolean showErrors )
public static void populateProperties( MavenExecutionRequest request, CommandLine commandLine )
{
Properties systemProperties = new Properties();
Properties userProperties = new Properties();
populateProperties( commandLine, systemProperties, userProperties );
request.setUserProperties( userProperties );
request.setSystemProperties( systemProperties );
}
public static MavenExecutionRequest populateRequest( MavenExecutionRequest request, CommandLine commandLine,
boolean debug, boolean quiet, boolean showErrors )
{
// ----------------------------------------------------------------------
// Now that we have everything that we need we will fire up plexus and
// bring the maven component to life for use.
// ----------------------------------------------------------------------
boolean interactive = true;
if ( commandLine.hasOption( CLIManager.BATCH_MODE ) )
{
interactive = false;
request.setInteractiveMode( false );
}
boolean pluginUpdateOverride = false;
@ -105,11 +113,9 @@ final class CLIRequestUtils
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_NEVER;
}
boolean offline = false;
if ( commandLine.hasOption( CLIManager.OFFLINE ) )
{
offline = true;
request.setOffline( true );
}
boolean updateSnapshots = false;
@ -172,7 +178,7 @@ final class CLIRequestUtils
MavenTransferListener transferListener;
if ( interactive )
if ( request.isInteractiveMode() )
{
transferListener = new ConsoleDownloadMonitor();
}
@ -221,7 +227,7 @@ final class CLIRequestUtils
userToolchainsFile = MavenEmbedder.DEFAULT_USER_TOOLCHAINS_FILE;
}
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
request
.setBaseDirectory( baseDirectory )
.setGoals( goals )
.setSystemProperties( systemProperties )
@ -229,8 +235,6 @@ final class CLIRequestUtils
.setReactorFailureBehavior( reactorFailureBehaviour ) // default: fail fast
.setRecursive( recursive ) // default: true
.setShowErrors( showErrors ) // default: false
.setInteractiveMode( interactive ) // default: true
.setOffline( offline ) // default: false
.setUsePluginUpdateOverride( pluginUpdateOverride )
.addActiveProfiles( activeProfiles ) // optional
.addInactiveProfiles( inactiveProfiles ) // optional

View File

@ -16,6 +16,7 @@ package org.apache.maven.cli;
*/
import java.io.File;
import java.io.IOException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
@ -27,10 +28,17 @@ import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
import org.apache.maven.embedder.MavenEmbedderException;
import org.apache.maven.embedder.MavenEmbedderFileLogger;
import org.apache.maven.embedder.MavenEmbedderLogger;
import org.apache.maven.embedder.execution.MavenExecutionRequestPopulator;
import org.apache.maven.exception.ExceptionSummary;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.settings.MavenSettingsBuilder;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.sonatype.plexus.components.cipher.DefaultPlexusCipher;
import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
@ -114,12 +122,108 @@ public class MavenCli
System.setProperty( "maven.home", new File( mavenHome ).getAbsolutePath() );
}
MavenExecutionRequest request = CLIRequestUtils.buildRequest( commandLine, debug, quiet, showErrors );
Configuration configuration = buildEmbedderConfiguration( request, commandLine, classWorld );
Configuration configuration = buildEmbedderConfiguration( commandLine, classWorld );
MavenEmbedderLogger logger = configuration.getMavenEmbedderLogger();
MavenEmbedder mavenEmbedder;
try
{
mavenEmbedder = new MavenEmbedder( configuration );
}
catch ( MavenEmbedderException e )
{
CLIReportingUtils.showError( logger, "Unable to start the embedder: ", e, showErrors );
return 1;
}
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setGlobalSettingsFile( configuration.getGlobalSettingsFile() );
request.setUserSettingsFile( configuration.getUserSettingsFile() );
CLIRequestUtils.populateProperties( request, commandLine );
Settings settings;
try
{
MavenSettingsBuilder settingsBuilder =
mavenEmbedder.getPlexusContainer().lookup( MavenSettingsBuilder.class );
try
{
settings = settingsBuilder.buildSettings( request );
}
finally
{
try
{
mavenEmbedder.getPlexusContainer().release( settingsBuilder );
}
catch ( ComponentLifecycleException e )
{
logger.debug( "Failed to release component: " + e.getMessage(), e );
}
}
}
catch ( ComponentLookupException e )
{
CLIReportingUtils.showError( logger, "Unable to lookup settings builder: ", e, showErrors );
return 1;
}
catch ( IOException e )
{
CLIReportingUtils.showError( logger, "Failed to read settings: ", e, showErrors );
return 1;
}
catch ( XmlPullParserException e )
{
CLIReportingUtils.showError( logger, "Failed to parse settings: ", e, showErrors );
return 1;
}
try
{
MavenExecutionRequestPopulator requestPopulator =
mavenEmbedder.getPlexusContainer().lookup( MavenExecutionRequestPopulator.class );
try
{
requestPopulator.populateFromSettings( request, settings );
}
finally
{
try
{
mavenEmbedder.getPlexusContainer().release( requestPopulator );
}
catch ( ComponentLifecycleException e )
{
logger.debug( "Failed to release component: " + e.getMessage(), e );
}
}
}
catch ( ComponentLookupException e )
{
CLIReportingUtils.showError( logger, "Unable to lookup execution request populator: ", e, showErrors );
return 1;
}
catch ( MavenEmbedderException e )
{
CLIReportingUtils.showError( logger, "Failed to process settings: ", e, showErrors );
return 1;
}
CLIRequestUtils.populateRequest( request, commandLine, debug, quiet, showErrors );
request.setExecutionListener( new ExecutionEventLogger( logger ) );
if ( debug || commandLine.hasOption( CLIManager.SHOW_VERSION ) )
@ -169,19 +273,6 @@ public class MavenCli
request.setUserSettingsFile( configuration.getUserSettingsFile() );
}
MavenEmbedder mavenEmbedder;
try
{
mavenEmbedder = new MavenEmbedder( configuration );
}
catch ( MavenEmbedderException e )
{
CLIReportingUtils.showError( logger, "Unable to start the embedder: ", e, showErrors );
return 1;
}
try
{
if ( commandLine.hasOption( CLIManager.ENCRYPT_MASTER_PASSWORD ) )
@ -290,7 +381,7 @@ public class MavenCli
}
}
private Configuration buildEmbedderConfiguration( MavenExecutionRequest request, CommandLine commandLine, ClassWorld classWorld )
private Configuration buildEmbedderConfiguration( CommandLine commandLine, ClassWorld classWorld )
{
File userSettingsFile;
@ -318,7 +409,7 @@ public class MavenCli
if ( commandLine.hasOption( CLIManager.LOG_FILE ) )
{
File logFile = new File( request.getBaseDirectory(), commandLine.getOptionValue( CLIManager.LOG_FILE ) );
File logFile = new File( commandLine.getOptionValue( CLIManager.LOG_FILE ) ).getAbsoluteFile();
configuration.setMavenEmbedderLogger( new MavenEmbedderFileLogger( logFile ) );
}
@ -327,13 +418,6 @@ public class MavenCli
configuration.setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() );
}
String localRepoProperty = request.getUserProperties().getProperty( LOCAL_REPO_PROPERTY );
if ( localRepoProperty != null )
{
configuration.setLocalRepository( new File( localRepoProperty ) );
}
return configuration;
}

View File

@ -48,17 +48,6 @@ public interface Configuration
File getGlobalSettingsFile();
// ----------------------------------------------------------------------------
// Local Repository
// ----------------------------------------------------------------------------
/**
* This overrides anything set in a settings file.
*/
Configuration setLocalRepository( File localRepository );
File getLocalRepository();
// ----------------------------------------------------------------------------
// Logger
// ----------------------------------------------------------------------------

View File

@ -55,8 +55,6 @@ public class DefaultConfiguration
private PlexusContainer parentContainer;
private File localRepository;
/** Creates a new instance of DefaultConfiguration */
public DefaultConfiguration()
{
@ -202,19 +200,4 @@ public class DefaultConfiguration
return this;
}
// ----------------------------------------------------------------------------
// Local Repository
// ----------------------------------------------------------------------------
public Configuration setLocalRepository( File localRepository )
{
this.localRepository = localRepository;
return this;
}
public File getLocalRepository()
{
return localRepository;
}
}

View File

@ -24,11 +24,9 @@ import java.util.Set;
import org.apache.maven.Maven;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.embedder.MavenEmbedder;
import org.apache.maven.embedder.MavenEmbedderException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.MavenSettingsBuilder;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
@ -49,16 +47,116 @@ public class DefaultMavenExecutionRequestPopulator
@Requirement
private Logger logger;
//TODO: this needs to be pushed up to the front-end
@Requirement
private MavenSettingsBuilder settingsBuilder;
@Requirement
private RepositorySystem repositorySystem;
@Requirement( hint = "maven" )
private SecDispatcher securityDispatcher;
public MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
throws MavenEmbedderException
{
request.setOffline( settings.isOffline() );
request.setInteractiveMode( settings.isInteractiveMode() );
request.setPluginGroups( settings.getPluginGroups() );
request.setLocalRepositoryPath( settings.getLocalRepository() );
for ( Server server : settings.getServers() )
{
server = server.clone();
String password = decrypt( server.getPassword(), "password for server " + server.getId() );
server.setPassword( password );
request.addServer( server );
}
// <proxies>
// <proxy>
// <active>true</active>
// <protocol>http</protocol>
// <host>proxy.somewhere.com</host>
// <port>8080</port>
// <username>proxyuser</username>
// <password>somepassword</password>
// <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
// </proxy>
// </proxies>
for ( Proxy proxy : settings.getProxies() )
{
if ( !proxy.isActive() )
{
continue;
}
proxy = proxy.clone();
String password = decrypt( proxy.getPassword(), "password for proxy " + proxy.getId() );
proxy.setPassword( password );
request.addProxy( proxy );
}
// <mirrors>
// <mirror>
// <id>nexus</id>
// <mirrorOf>*</mirrorOf>
// <url>http://repository.sonatype.org/content/groups/public</url>
// </mirror>
// </mirrors>
for ( Mirror mirror : settings.getMirrors() )
{
mirror = mirror.clone();
request.addMirror( mirror );
}
request.setActiveProfiles( settings.getActiveProfiles() );
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
{
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
}
return request;
}
private String decrypt( String encrypted, String source )
{
try
{
return securityDispatcher.decrypt( encrypted );
}
catch ( SecDispatcherException e )
{
logger.warn( "Not decrypting " + source + " due to exception in security handler: " + e.getMessage() );
Throwable cause = e;
while ( cause.getCause() != null )
{
cause = cause.getCause();
}
if ( cause instanceof FileNotFoundException )
{
logger.warn( "Ensure that you have configured your master password file (and relocation if appropriate)." );
logger.warn( "See the installation instructions for details." );
}
logger.debug( "Full stack trace follows", e );
return encrypted;
}
}
private void pom( MavenExecutionRequest request )
{
if ( request.getPom() != null && !request.getPom().isAbsolute() )
@ -89,43 +187,6 @@ public class DefaultMavenExecutionRequestPopulator
request.addPluginGroup( "org.codehaus.mojo" );
}
// Process plugin groups
// Get profile models
// Get active profiles
private void processSettings( MavenExecutionRequest request )
throws MavenEmbedderException
{
Settings settings = request.getSettings();
request.addPluginGroups( settings.getPluginGroups() );
populateDefaultPluginGroups( request );
// We just need to keep track of what profiles are being activated by the settings. We don't need to process
// them here. This should be taken care of by the project builder.
//
request.addActiveProfiles( settings.getActiveProfiles() );
// We only need to take the profiles and make sure they are available when the calculation of the active profiles
// is determined.
//
List<org.apache.maven.settings.Profile> settingsProfiles = settings.getProfiles();
if ( ( settingsProfiles != null ) && !settingsProfiles.isEmpty() )
{
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
{
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
}
}
injectDefaultRepositories( request );
injectDefaultPluginRepositories( request );
processRepositoriesInSettings( request );
}
private void injectDefaultRepositories( MavenExecutionRequest request )
throws MavenEmbedderException
{
@ -180,62 +241,6 @@ public class DefaultMavenExecutionRequestPopulator
private void processRepositoriesInSettings( MavenExecutionRequest request )
throws MavenEmbedderException
{
Settings settings = request.getSettings();
// <proxies>
// <proxy>
// <active>true</active>
// <protocol>http</protocol>
// <host>proxy.somewhere.com</host>
// <port>8080</port>
// <username>proxyuser</username>
// <password>somepassword</password>
// <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
// </proxy>
// </proxies>
for ( Proxy proxy : settings.getProxies() )
{
if ( !proxy.isActive() )
{
continue;
}
proxy = proxy.clone();
String password = decrypt( proxy.getPassword(), "password for proxy " + proxy.getId() );
proxy.setPassword( password );
request.addProxy( proxy );
}
for ( Server server : settings.getServers() )
{
server = server.clone();
String password = decrypt( server.getPassword(), "password for server " + server.getId() );
server.setPassword( password );
request.addServer( server );
}
// <mirrors>
// <mirror>
// <id>nexus</id>
// <mirrorOf>*</mirrorOf>
// <url>http://repository.sonatype.org/content/groups/public</url>
// </mirror>
// </mirrors>
for ( Mirror mirror : settings.getMirrors() )
{
mirror = mirror.clone();
request.addMirror( mirror );
}
repositorySystem.injectMirror( request.getRemoteRepositories(), request.getMirrors() );
repositorySystem.injectProxy( request.getRemoteRepositories(), request.getProxies() );
repositorySystem.injectAuthentication( request.getRemoteRepositories(), request.getServers() );
@ -249,75 +254,6 @@ public class DefaultMavenExecutionRequestPopulator
request.setPluginArtifactRepositories( repositorySystem.getEffectiveRepositories( request.getPluginArtifactRepositories() ) );
}
private String decrypt( String encrypted, String source )
{
try
{
return securityDispatcher.decrypt( encrypted );
}
catch ( SecDispatcherException e )
{
logger.warn( "Not decrypting " + source + " due to exception in security handler: " + e.getMessage() );
Throwable cause = e;
while ( cause.getCause() != null )
{
cause = cause.getCause();
}
if ( cause instanceof FileNotFoundException )
{
logger.warn( "Ensure that you have configured your master password file (and relocation if appropriate)." );
logger.warn( "See the installation instructions for details." );
}
logger.debug( "Full stack trace follows", e );
return encrypted;
}
}
// ------------------------------------------------------------------------
// Settings
// ------------------------------------------------------------------------
private void settings( MavenExecutionRequest request )
{
// ------------------------------------------------------------------------
// Settings
//
// If a settings instance has been provided in the request then we use
// that for execution, otherwise we will look in the embedder configuration
// for a user/global settings file to use. The settings file should have
// been validated upfront but we will still catch any parsing exception
// ------------------------------------------------------------------------
if ( request.getSettings() == null )
{
if ( request.getGlobalSettingsFile() == null )
{
request.setGlobalSettingsFile( MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE );
}
if ( request.getUserSettingsFile() == null )
{
request.setUserSettingsFile( MavenEmbedder.DEFAULT_USER_SETTINGS_FILE );
}
try
{
Settings settings = settingsBuilder.buildSettings( request );
request.setSettings( settings );
}
catch ( Exception e )
{
request.setSettings( new Settings() );
}
}
}
private void localRepository( MavenExecutionRequest request )
throws MavenEmbedderException
{
@ -331,7 +267,7 @@ public class DefaultMavenExecutionRequestPopulator
if ( request.getLocalRepository() == null )
{
request.setLocalRepository( createLocalRepository( request, request.getSettings() ) );
request.setLocalRepository( createLocalRepository( request ) );
}
if ( request.getLocalRepositoryPath() == null )
@ -344,7 +280,7 @@ public class DefaultMavenExecutionRequestPopulator
// Artifact Transfer Mechanism
// ------------------------------------------------------------------------
public ArtifactRepository createLocalRepository( MavenExecutionRequest request, Settings settings )
public ArtifactRepository createLocalRepository( MavenExecutionRequest request )
throws MavenEmbedderException
{
String localRepositoryPath = null;
@ -354,11 +290,6 @@ public class DefaultMavenExecutionRequestPopulator
localRepositoryPath = request.getLocalRepositoryPath().getAbsolutePath();
}
if ( StringUtils.isEmpty( localRepositoryPath ) )
{
localRepositoryPath = settings.getLocalRepository();
}
if ( StringUtils.isEmpty( localRepositoryPath ) )
{
localRepositoryPath = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
@ -379,12 +310,17 @@ public class DefaultMavenExecutionRequestPopulator
{
pom( request );
settings( request );
localRepository( request );
processSettings( request );
populateDefaultPluginGroups( request );
injectDefaultRepositories( request );
injectDefaultPluginRepositories( request );
processRepositoriesInSettings( request );
return request;
}
}

View File

@ -21,9 +21,19 @@ package org.apache.maven.embedder.execution;
import org.apache.maven.embedder.MavenEmbedderException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.settings.Settings;
/**
* Assists in populating an execution request for invocation of Maven.
*
* @author Benjamin Bentmann
*/
public interface MavenExecutionRequestPopulator
{
MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
throws MavenEmbedderException;
MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
throws MavenEmbedderException;

View File

@ -27,6 +27,7 @@ import junit.framework.TestCase;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
public class CLIRequestUtilsTest
@ -58,7 +59,8 @@ public class CLIRequestUtilsTest
assertEquals( 1, commandLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY ).length );
MavenExecutionRequest request = CLIRequestUtils.buildRequest( commandLine, false, false, false );
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request = CLIRequestUtils.populateRequest( request, commandLine, false, false, false );
Properties userProperties = request.getUserProperties();
@ -105,8 +107,8 @@ public class CLIRequestUtilsTest
{
String path = new File( "" ).getAbsolutePath();
MavenExecutionRequest request =
CLIRequestUtils.buildRequest( parse( "-Dmaven.repo.local=" + path ), false, false, false );
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
CLIRequestUtils.populateRequest( request, parse( "-Dmaven.repo.local=" + path ), false, false, false );
assertEquals( path, request.getLocalRepositoryPath().getAbsolutePath() );
}

View File

@ -19,8 +19,6 @@ package org.apache.maven.embedder;
* under the License.
*/
import java.io.File;
/**
* A configuration to be used for unit testing of the embedder. This basically sets some default values.
*
@ -32,13 +30,6 @@ public class SimpleConfiguration
public SimpleConfiguration()
{
String localRepo = System.getProperty( "maven.repo.local", "" );
if ( localRepo.length() > 0 )
{
setLocalRepository( new File( localRepo ).getAbsoluteFile() );
}
setClassLoader( Thread.currentThread().getContextClassLoader() );
setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() );