diff --git a/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java b/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java index 2328207793..54fe893afc 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java @@ -41,7 +41,6 @@ public class DefaultMavenSettingsBuilder extends AbstractLogEnabled implements MavenSettingsBuilder { - private SettingsValidator validator; /** @@ -50,25 +49,6 @@ public class DefaultMavenSettingsBuilder public Settings buildSettings( File userSettingsFile, File globalSettingsFile ) throws IOException, XmlPullParserException { - return buildSettings( userSettingsFile, globalSettingsFile, new SettingsBuilderAdvice() ); - } - - /** - * @since 2.1 - */ - public Settings buildSettings( File userSettingsFile, File globalSettingsFile, SettingsBuilderAdvice advice ) - throws IOException, XmlPullParserException - { - if ( advice.isDefaultUserLocationEnabled() && userSettingsFile == null ) - { - userSettingsFile = DEFAULT_USER_SETTINGS_FILE; - } - - if ( advice.isDefaultGlobalLocationEnabled() && globalSettingsFile == null ) - { - globalSettingsFile = DEFAULT_GLOBAL_SETTINGS_FILE; - } - if ( globalSettingsFile == null && userSettingsFile == null ) { getLogger().debug( @@ -105,24 +85,6 @@ public class DefaultMavenSettingsBuilder return userSettings; } - /** - * @deprecated - */ - public Settings buildSettings() - throws IOException, XmlPullParserException - { - return buildSettings( DEFAULT_USER_SETTINGS_FILE ); - } - - /** - * @deprecated - */ - public Settings buildSettings( File userSettingsFile ) - throws IOException, XmlPullParserException - { - return buildSettings( userSettingsFile, null ); - } - private Settings readSettings( File settingsFile ) throws IOException, XmlPullParserException { @@ -142,6 +104,7 @@ public class DefaultMavenSettingsBuilder try { reader = new FileReader( settingsFile ); + StringWriter sWriter = new StringWriter(); IOUtil.copy( reader, sWriter ); @@ -151,6 +114,7 @@ public class DefaultMavenSettingsBuilder try { RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); + interpolator.addValueSource( new EnvarBasedValueSource() ); rawInput = interpolator.interpolate( rawInput, "settings" ); @@ -220,6 +184,5 @@ public class DefaultMavenSettingsBuilder { throw new IOException( "Failed to validate Settings file at " + location + "\n" + validationResult.render( "\n" ) ); } - } } diff --git a/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java b/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java index a54d6dacf8..5783a01724 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java @@ -29,33 +29,9 @@ public interface MavenSettingsBuilder { String ROLE = MavenSettingsBuilder.class.getName(); - File DEFAULT_USER_SETTINGS_FILE = new File( System.getProperty( "user.home" ), ".m2/settings.xml" ); - - File DEFAULT_GLOBAL_SETTINGS_FILE = new File( System - .getProperty( "maven.home", System.getProperty( "user.dir", "" ) ), "conf/settings.xml" ); - - /** - * @deprecated - */ - Settings buildSettings() - throws IOException, XmlPullParserException; - - /** - * @deprecated - */ - Settings buildSettings( File userSettingsFile ) - throws IOException, XmlPullParserException; - /** * @since 2.1 */ Settings buildSettings( File userSettingsFile, File globalSettingsFile ) throws IOException, XmlPullParserException; - - /** - * @since 2.1 - */ - Settings buildSettings( File userSettingsPath, File globalSettingsPath, SettingsBuilderAdvice advice ) - throws IOException, XmlPullParserException; - } diff --git a/maven-settings/src/main/java/org/apache/maven/settings/SettingsBuilderAdvice.java b/maven-settings/src/main/java/org/apache/maven/settings/SettingsBuilderAdvice.java deleted file mode 100644 index 56acd690ca..0000000000 --- a/maven-settings/src/main/java/org/apache/maven/settings/SettingsBuilderAdvice.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.apache.maven.settings; - -public class SettingsBuilderAdvice -{ - - private boolean defaultUserLocationEnabled = true; - - private boolean defaultGlobalLocationEnabled = true; - - public boolean isDefaultGlobalLocationEnabled() - { - return defaultGlobalLocationEnabled; - } - - public boolean isDefaultUserLocationEnabled() - { - return defaultUserLocationEnabled; - } - - public void setDefaultGlobalLocationEnabled( boolean defaultGlobalLocationEnabled ) - { - this.defaultGlobalLocationEnabled = defaultGlobalLocationEnabled; - } - - public void setDefaultUserLocationEnabled( boolean defaultUserLocationEnabled ) - { - this.defaultUserLocationEnabled = defaultUserLocationEnabled; - } - -}