private FixedStringSearchInterpolator createEnvInterpolator() { PrefixedPropertiesValueSource envProps = new PrefixedPropertiesValueSource(Collections.singletonList("env."), CommandLineUtils.getSystemEnvVars(false), true ); return FixedStringSearchInterpolator.create( envProps ); } }
/** * Gets the shell environment variables for this process. Note that the returned mapping from variable names to * values will always be case-sensitive regardless of the platform, i.e. <code>getSystemEnvVars().get("path")</code> * and <code>getSystemEnvVars().get("PATH")</code> will in general return different values. However, on platforms * with case-insensitive environment variables like Windows, all variable names will be normalized to upper case. * * @return The shell environment variables, can be empty but never <code>null</code>. * @see System#getenv() System.getenv() API, new in JDK 5.0, to get the same result * <b>since 2.0.2 System#getenv() will be used if available in the current running jvm.</b> */ public static Properties getSystemEnvVars() { return getSystemEnvVars( !Os.isFamily( Os.FAMILY_WINDOWS ) ); }
private void findDefaultMavenHome() throws VerificationException { defaultClasspath = System.getProperty( "maven.bootclasspath" ); defaultClassworldConf = System.getProperty( "classworlds.conf" ); defaultMavenHome = System.getProperty( "maven.home" ); if ( defaultMavenHome == null ) { Properties envVars = CommandLineUtils.getSystemEnvVars(); defaultMavenHome = envVars.getProperty( "M2_HOME" ); } if ( defaultMavenHome == null ) { File f = new File( System.getProperty( "user.home" ), "m2" ); if ( new File( f, "bin/mvn" ).isFile() ) { defaultMavenHome = f.getAbsolutePath(); } } }
/** * Add system environment variables */ public void addSystemEnvironment() { Properties systemEnvVars = CommandLineUtils.getSystemEnvVars(); for ( Object o : systemEnvVars.keySet() ) { String key = (String) o; if ( !envVars.containsKey( key ) ) { addEnvironment( key, systemEnvVars.getProperty( key ) ); } } }
private FixedStringSearchInterpolator createEnvInterpolator() { PrefixedPropertiesValueSource envProps = new PrefixedPropertiesValueSource( Collections.singletonList( "env." ), CommandLineUtils.getSystemEnvVars( false ), true ); return FixedStringSearchInterpolator.create( envProps ); }