o Optimized performance

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@895249 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-01-02 18:12:44 +00:00
parent afb40dc0e9
commit 1957ff0de9
1 changed files with 17 additions and 8 deletions

View File

@ -101,6 +101,8 @@ public class MavenMetadataSource
@Requirement
private LegacySupport legacySupport;
private static Properties envVars;
private void injectSession( MetadataResolutionRequest request )
{
MavenSession session = legacySupport.getSession();
@ -699,18 +701,25 @@ public class MavenMetadataSource
{
Properties props = new Properties();
if ( envVars == null )
{
Properties tmp = new Properties();
try
{
Properties envVars = CommandLineUtils.getSystemEnvVars();
for ( Entry<Object, Object> e : envVars.entrySet() )
Properties env = CommandLineUtils.getSystemEnvVars();
for ( Entry<Object, Object> e : env.entrySet() )
{
props.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
tmp.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
}
}
catch ( IOException e )
{
logger.debug( "Error getting environment variables: " + e );
}
envVars = tmp;
}
props.putAll( envVars );
props.putAll( System.getProperties() );