mirror of https://github.com/apache/maven.git
merge from rev.379395
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@379411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1710fdcfa3
commit
353f7aedfc
|
@ -65,11 +65,11 @@ public class DefaultMavenSettingsBuilder
|
||||||
|
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
userSettingsFile = getFile( userSettingsPath, "user.home",
|
userSettingsFile =
|
||||||
MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION );
|
getFile( userSettingsPath, "user.home", MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION );
|
||||||
|
|
||||||
globalSettingsFile = getFile( globalSettingsPath, "maven.home",
|
globalSettingsFile =
|
||||||
MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION );
|
getFile( globalSettingsPath, "maven.home", MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION );
|
||||||
|
|
||||||
getLogger().debug(
|
getLogger().debug(
|
||||||
"Building Maven global-level settings from: '" + globalSettingsFile.getAbsolutePath() + "'" );
|
"Building Maven global-level settings from: '" + globalSettingsFile.getAbsolutePath() + "'" );
|
||||||
|
@ -92,26 +92,27 @@ public class DefaultMavenSettingsBuilder
|
||||||
{
|
{
|
||||||
reader = new FileReader( settingsFile );
|
reader = new FileReader( settingsFile );
|
||||||
StringWriter sWriter = new StringWriter();
|
StringWriter sWriter = new StringWriter();
|
||||||
|
|
||||||
IOUtil.copy( reader, sWriter );
|
IOUtil.copy( reader, sWriter );
|
||||||
|
|
||||||
String rawInput = sWriter.toString();
|
String rawInput = sWriter.toString();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
|
RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
|
||||||
interpolator.addValueSource( new EnvarBasedValueSource() );
|
interpolator.addValueSource( new EnvarBasedValueSource() );
|
||||||
|
|
||||||
rawInput = interpolator.interpolate( rawInput, "settings" );
|
rawInput = interpolator.interpolate( rawInput, "settings" );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment substitution in settings." );
|
getLogger().warn(
|
||||||
|
"Failed to initialize environment variable resolver. Skipping environment substitution in settings." );
|
||||||
getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e );
|
getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
StringReader sReader = new StringReader( rawInput );
|
StringReader sReader = new StringReader( rawInput );
|
||||||
|
|
||||||
SettingsXpp3Reader modelReader = new SettingsXpp3Reader();
|
SettingsXpp3Reader modelReader = new SettingsXpp3Reader();
|
||||||
|
|
||||||
settings = modelReader.read( sReader );
|
settings = modelReader.read( sReader );
|
||||||
|
@ -145,6 +146,11 @@ public class DefaultMavenSettingsBuilder
|
||||||
Settings globalSettings = readSettings( globalSettingsFile );
|
Settings globalSettings = readSettings( globalSettingsFile );
|
||||||
Settings userSettings = readSettings( userSettingsFile );
|
Settings userSettings = readSettings( userSettingsFile );
|
||||||
|
|
||||||
|
if ( globalSettings == null )
|
||||||
|
{
|
||||||
|
globalSettings = new Settings();
|
||||||
|
}
|
||||||
|
|
||||||
if ( userSettings == null )
|
if ( userSettings == null )
|
||||||
{
|
{
|
||||||
userSettings = new Settings();
|
userSettings = new Settings();
|
||||||
|
@ -152,7 +158,7 @@ public class DefaultMavenSettingsBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsUtils.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL );
|
SettingsUtils.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL );
|
||||||
|
|
||||||
activateDefaultProfiles( userSettings );
|
activateDefaultProfiles( userSettings );
|
||||||
|
|
||||||
setLocalRepository( userSettings );
|
setLocalRepository( userSettings );
|
||||||
|
@ -166,8 +172,8 @@ public class DefaultMavenSettingsBuilder
|
||||||
private void activateDefaultProfiles( Settings settings )
|
private void activateDefaultProfiles( Settings settings )
|
||||||
{
|
{
|
||||||
List activeProfiles = settings.getActiveProfiles();
|
List activeProfiles = settings.getActiveProfiles();
|
||||||
|
|
||||||
for( Iterator profiles = settings.getProfiles().iterator(); profiles.hasNext(); )
|
for ( Iterator profiles = settings.getProfiles().iterator(); profiles.hasNext(); )
|
||||||
{
|
{
|
||||||
Profile profile = (Profile) profiles.next();
|
Profile profile = (Profile) profiles.next();
|
||||||
if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() )
|
if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() )
|
||||||
|
|
Loading…
Reference in New Issue