当前位置: 首页>>代码示例>>Java>>正文


Java CommandLineUtils.getSystemEnvVars方法代码示例

本文整理汇总了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;
}
 
开发者ID:mojohaus,项目名称:cassandra-maven-plugin,代码行数:24,代码来源:AbstractCassandraMojo.java

示例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;
}
 
开发者ID:odiszapc,项目名称:stem,代码行数:15,代码来源:ExternalNode.java

示例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;
}
 
开发者ID:mojohaus,项目名称:exec-maven-plugin,代码行数:46,代码来源:ExecMojo.java

示例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);
    }
}
 
开发者ID:egineering-llc,项目名称:gitflow-helper-maven-plugin,代码行数:44,代码来源:AbstractGitflowBranchMojo.java

示例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();
}
 
开发者ID:mojohaus,项目名称:properties-maven-plugin,代码行数:12,代码来源:ReadPropertiesMojo.java


注:本文中的org.codehaus.plexus.util.cli.CommandLineUtils.getSystemEnvVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。