mirror of https://github.com/apache/maven.git
MNG-2835 Make sure the global settings are obeyed when they are the only settings provided
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@512890 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37692fbea1
commit
24b3c86c9b
|
@ -119,6 +119,9 @@ public class MavenEmbedder
|
|||
|
||||
public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );
|
||||
|
||||
public static final File DEFAULT_GLOBAL_SETTINGS_FILE = new File( System
|
||||
.getProperty( "maven.home", System.getProperty( "user.dir", "" ) ), "conf/settings.xml" );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -613,13 +616,10 @@ public class MavenEmbedder
|
|||
|
||||
try
|
||||
{
|
||||
if ( configuration.getUserSettingsFile() == null )
|
||||
{
|
||||
configuration.setUserSettingsFile( DEFAULT_USER_SETTINGS_FILE );
|
||||
}
|
||||
|
||||
settings = settingsBuilder.buildSettings( configuration.getUserSettingsFile(),
|
||||
configuration.getGlobalSettingsFile() );
|
||||
|
||||
System.out.println( "settings.getLocalRepository() = " + settings.getLocalRepository() );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
|
@ -721,32 +721,30 @@ public class MavenEmbedder
|
|||
{
|
||||
ConfigurationValidationResult result = new DefaultConfigurationValidationResult();
|
||||
|
||||
if ( configuration.getUserSettingsFile() == null )
|
||||
{
|
||||
configuration.setUserSettingsFile( MavenEmbedder.DEFAULT_USER_SETTINGS_FILE );
|
||||
}
|
||||
|
||||
Reader fileReader;
|
||||
|
||||
// User settings
|
||||
|
||||
try
|
||||
if ( configuration.getUserSettingsFile() != null )
|
||||
{
|
||||
fileReader = new FileReader( configuration.getUserSettingsFile() );
|
||||
try
|
||||
{
|
||||
fileReader = new FileReader( configuration.getUserSettingsFile() );
|
||||
|
||||
new SettingsXpp3Reader().read( fileReader );
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
result.setUserSettingsFilePresent( false );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
result.setUserSettingsFileParses( false );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
result.setUserSettingsFileParses( false );
|
||||
new SettingsXpp3Reader().read( fileReader );
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
result.setUserSettingsFilePresent( false );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
result.setUserSettingsFileParses( false );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
result.setUserSettingsFileParses( false );
|
||||
}
|
||||
}
|
||||
|
||||
// Global settings
|
||||
|
|
Loading…
Reference in New Issue