本文整理汇总了Java中org.codehaus.plexus.util.cli.CommandLineUtils.getSystemEnvVars方法的典型用法代码示例。如果您正苦于以下问题:Java CommandLineUtils.getSystemEnvVars方法的具体用法?Java CommandLineUtils.getSystemEnvVars怎么用?Java CommandLineUtils.getSystemEnvVars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.util.cli.CommandLineUtils
的用法示例。
在下文中一共展示了CommandLineUtils.getSystemEnvVars方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEnvironmentVars
import org.codehaus.plexus.util.cli.CommandLineUtils; //导入方法依赖的package包/类
/**
* Creates the environment required when launching Cassandra or the CLI tools.
*
* @return the environment required when launching Cassandra or the CLI tools.
*/
protected Map<String, String> createEnvironmentVars()
{
Map<String, String> enviro = new HashMap<String, String>();
try
{
Properties systemEnvVars = CommandLineUtils.getSystemEnvVars();
for ( Map.Entry entry : systemEnvVars.entrySet() )
{
enviro.put( (String) entry.getKey(), (String) entry.getValue() );
}
}
catch ( IOException x )
{
getLog().error( "Could not assign default system enviroment variables.", x );
}
enviro.put( "CASSANDRA_CONF", new File( cassandraDir, "conf" ).getAbsolutePath() );
return enviro;
}
示例2: createEnvironmentVars
import org.codehaus.plexus.util.cli.CommandLineUtils; //导入方法依赖的package包/类
private Map<String, String> createEnvironmentVars(File nodeDir) {
Map<String, String> env = new HashMap<String, String>();
try {
Properties properties = CommandLineUtils.getSystemEnvVars();
for (Map.Entry prop : properties.entrySet()) {
env.put((String) prop.getKey(), (String) prop.getValue());
}
} catch (IOException e) {
log.error("Could not assign default system environment variables.", e);
}
env.put("stem.config", new File(new File(nodeDir, "conf"), "stem.yaml").getAbsolutePath());
return env;
}
示例3: handleSystemEnvVariables
import org.codehaus.plexus.util.cli.CommandLineUtils; //导入方法依赖的package包/类
private Map<String, String> handleSystemEnvVariables()
throws MojoExecutionException
{
Map<String, String> enviro = new HashMap<String, String>();
try
{
Properties systemEnvVars = CommandLineUtils.getSystemEnvVars();
for ( Map.Entry<?, ?> entry : systemEnvVars.entrySet() )
{
enviro.put( (String) entry.getKey(), (String) entry.getValue() );
}
}
catch ( IOException x )
{
getLog().error( "Could not assign default system enviroment variables.", x );
}
if ( environmentVariables != null )
{
enviro.putAll( environmentVariables );
}
if ( this.environmentScript != null )
{
getLog().info( "Pick up external environment script: " + this.environmentScript );
Map<String, String> envVarsFromScript = this.createEnvs( this.environmentScript );
if ( envVarsFromScript != null )
{
enviro.putAll( envVarsFromScript );
}
}
if ( this.getLog().isDebugEnabled() )
{
Set<String> keys = new TreeSet<String>();
keys.addAll( enviro.keySet() );
for ( String key : keys )
{
this.getLog().debug( "env: " + key + "=" + enviro.get( key ) );
}
}
return enviro;
}
示例4: execute
import org.codehaus.plexus.util.cli.CommandLineUtils; //导入方法依赖的package包/类
public void execute() throws MojoExecutionException, MojoFailureException {
if (gitBranchExpression == null) {
gitBranchExpression = ScmUtils.resolveBranchOrExpression(scmManager, project, getLog());
}
try {
systemEnvVars = CommandLineUtils.getSystemEnvVars();
} catch (IOException ioe) {
throw new MojoExecutionException("Unable to read System Envirionment Variables: ", ioe);
}
// Try to resolve the gitBranchExpression to an actual Value...
String gitBranch = resolveExpression(gitBranchExpression);
ExpansionBuffer eb = new ExpansionBuffer(gitBranch);
if (!gitBranchExpression.equals(gitBranch) || getLog().isDebugEnabled()) { // Resolves Issue #9
getLog().debug("Resolved gitBranchExpression: '" + gitBranchExpression + " to '" + gitBranch + "'");
}
if (!eb.hasMoreLegalPlaceholders()) {
/*
* (/origin/)?master goes to the maven 'release' repo.
* (/origin/)?release/(.*) , (/origin/)?hotfix/(.*) , and (/origin/)?bugfix/(.*) go to the maven 'stage' repo.
* (/origin/)?develop goes to the 'snapshot' repo.
* All other builds will use the default semantics for 'deploy'.
*/
if (gitBranch.matches(masterBranchPattern)) {
logExecute(GitBranchType.MASTER, gitBranch, masterBranchPattern);
} else if (gitBranch.matches(supportBranchPattern)) {
logExecute(GitBranchType.SUPPORT, gitBranch, supportBranchPattern);
} else if (gitBranch.matches(releaseBranchPattern)) {
logExecute(GitBranchType.RELEASE, gitBranch, releaseBranchPattern);
} else if (gitBranch.matches(hotfixBranchPattern)) {
logExecute(GitBranchType.HOTFIX, gitBranch, hotfixBranchPattern);
} else if (gitBranch.matches(developmentBranchPattern)) {
logExecute(GitBranchType.DEVELOPMENT, gitBranch, developmentBranchPattern);
} else {
logExecute(GitBranchType.OTHER, gitBranch, null);
}
} else {
logExecute(GitBranchType.UNDEFINED, gitBranch, null);
}
}
示例5: getSystemEnvVars
import org.codehaus.plexus.util.cli.CommandLineUtils; //导入方法依赖的package包/类
/**
* Override-able for test purposes.
*
* @return The shell environment variables, can be empty but never <code>null</code>.
* @throws IOException If the environment variables could not be queried from the shell.
*/
Properties getSystemEnvVars()
throws IOException
{
return CommandLineUtils.getSystemEnvVars();
}