System.setProperty( MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION, globalSettingsPath );
}
Settings settings = null;
MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) embedder.lookup( MavenSettingsBuilder.ROLE );
try
{
if ( userSettingsPath != null )
{
File userSettingsFile = new File( userSettingsPath );
if ( userSettingsFile.exists() && !userSettingsFile.isDirectory() )
{
settings = settingsBuilder.buildSettings( userSettingsFile );
}
else
{
System.out.println( "WARNING: Alternate user settings file: " + userSettingsPath +
" is invalid. Using default path." );
}
}
if ( settings == null )
{
settings = settingsBuilder.buildSettings();
}
}
catch ( IOException e )
{
throw new SettingsConfigurationException( "Error reading settings file", e );