o Preferred JRE API

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@895277 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-01-02 20:01:19 +00:00
parent 1957ff0de9
commit a5b2dd1a1f
2 changed files with 12 additions and 26 deletions

View File

@ -16,7 +16,6 @@ package org.apache.maven.project.artifact;
*/ */
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -25,10 +24,10 @@ import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.Map.Entry;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.artifact.ArtifactUtils;
@ -70,7 +69,7 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.cli.CommandLineUtils; import org.codehaus.plexus.util.Os;
/** /**
* @author Jason van Zyl * @author Jason van Zyl
@ -704,17 +703,11 @@ public class MavenMetadataSource
if ( envVars == null ) if ( envVars == null )
{ {
Properties tmp = new Properties(); Properties tmp = new Properties();
try boolean caseSensitive = !Os.isFamily( Os.FAMILY_WINDOWS );
for ( Map.Entry<String, String> entry : System.getenv().entrySet() )
{ {
Properties env = CommandLineUtils.getSystemEnvVars(); String key = "env." + ( caseSensitive ? entry.getKey() : entry.getKey().toUpperCase( Locale.ENGLISH ) );
for ( Entry<Object, Object> e : env.entrySet() ) tmp.setProperty( key, entry.getValue() );
{
tmp.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
}
}
catch ( IOException e )
{
logger.debug( "Error getting environment variables: " + e );
} }
envVars = tmp; envVars = tmp;
} }

View File

@ -17,16 +17,15 @@ package org.apache.maven.cli;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Map.Entry;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
@ -53,8 +52,8 @@ import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.ClassWorld; import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.sonatype.plexus.components.cipher.DefaultPlexusCipher; import org.sonatype.plexus.components.cipher.DefaultPlexusCipher;
import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher; import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
@ -907,17 +906,11 @@ public class MavenCli
{ {
// add the env vars to the property set, with the "env." prefix // add the env vars to the property set, with the "env." prefix
// XXX support for env vars should probably be removed from the ModelInterpolator // XXX support for env vars should probably be removed from the ModelInterpolator
try boolean caseSensitive = !Os.isFamily( Os.FAMILY_WINDOWS );
for ( Map.Entry<String, String> entry : System.getenv().entrySet() )
{ {
Properties envVars = CommandLineUtils.getSystemEnvVars(); String key = "env." + ( caseSensitive ? entry.getKey() : entry.getKey().toUpperCase( Locale.ENGLISH ) );
for ( Entry<Object, Object> e : envVars.entrySet() ) systemProperties.setProperty( key, entry.getValue() );
{
systemProperties.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
}
}
catch ( IOException e )
{
System.err.println( "Error getting environment vars for profile activation: " + e );
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------