/** * Add system environment variables */ public void addSystemEnvironment() throws Exception { Properties systemEnvVars = CommandLineUtils.getSystemEnvVars(); for ( Object o : systemEnvVars.keySet() ) { String key = (String) o; if ( !envVars.containsKey( key ) ) { addEnvironment( key, systemEnvVars.getProperty( key ) ); } } }
commandline.addEnvironment( entry.getKey(), entry.getValue() );
protected void addMavenOpts(MvnContext context, Commandline cl) { if (isAddMavenOpts(context)) { String mavenOpts = System.getenv(MvnContext.MAVEN_OPTS); cl.addEnvironment(MvnContext.MAVEN_OPTS, mavenOpts); } }
public static void setupCommandlineEnv( Commandline cl, EnvFactory envFactory ) throws NativeBuildException { if ( envFactory != null ) { Map envs = envFactory.getEnvironmentVariables(); Iterator iter = envs.keySet().iterator(); while ( iter.hasNext() ) { String key = (String) iter.next(); cl.addEnvironment( key, (String) envs.get( key ) ); } } }
/** * Configure a commandline to use environment variables ($PATH) * * @param cl * @param ccmAddr * @throws ScmException */ private static void configureEnvironment( Commandline cl, String ccmAddr ) throws ScmException { // We need PATH to be set for using CCM try { Properties envVars = CommandLineUtils.getSystemEnvVars(); for ( @SuppressWarnings( "rawtypes" ) Iterator i = envVars.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); if ( !key.equalsIgnoreCase( "CCM_ADDR" ) ) { cl.addEnvironment( key, envVars.getProperty( key ) ); } } } catch ( Exception e1 ) { throw new ScmException( "Fail to add PATH environment variable.", e1 ); } cl.addEnvironment( "CCM_ADDR", ccmAddr ); }
public static int execute( Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { // SCM-482: force English resource bundle cl.addEnvironment( "LC_MESSAGES", "en" ); int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); exitCode = checkIfCleanUpIsNeeded( exitCode, cl, consumer, stderr, logger ); return exitCode; }
/** * Configure a commandline to use environment variables ($PATH) * * @param cl * @param ccmAddr * @throws ScmException */ private static void configureEnvironment( Commandline cl, String ccmAddr ) throws ScmException { // We need PATH to be set for using CCM try { Properties envVars = CommandLineUtils.getSystemEnvVars(); for ( @SuppressWarnings( "rawtypes" ) Iterator i = envVars.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); if ( !key.equalsIgnoreCase( "CCM_ADDR" ) ) { cl.addEnvironment( key, envVars.getProperty( key ) ); } } } catch ( Exception e1 ) { throw new ScmException( "Fail to add PATH environment variable.", e1 ); } cl.addEnvironment( "CCM_ADDR", ccmAddr ); }
public static int execute( Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { // SCM-482: force English resource bundle cl.addEnvironment( "LC_MESSAGES", "en" ); int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); exitCode = checkIfCleanUpIsNeeded( exitCode, cl, consumer, stderr, logger ); return exitCode; }
commandline.setWorkingDirectory(project.getBuild().getDirectory()); commandline.setExecutable(Paths.get(System.getProperty("java.home"), "bin", "java").toString()); commandline.addEnvironment("CLASSPATH", cp); commandline.addArguments(args);
private Commandline getCommandLine(ExecRequest request) { Commandline cl = new Commandline(); if (request.getShell().isPresent()) { cl.getShell().setShellCommand(request.getShell().get()); } cl.setExecutable(request.getExecutable()); cl.addArguments(request.getArgs().toArray(EMPTY_STRING_ARRAY)); if (request.getWorkingDirectory().isPresent()) { cl.setWorkingDirectory(request.getWorkingDirectory().get()); } addSystemEnvironmentVariables(cl, request.isAddSystemEnvironmentVariables()); // Explicit environment variables "win" over system environment variables for (Map.Entry<String, String> pair : request.getEnvironmentVariables().entrySet()) { cl.addEnvironment(pair.getKey(), pair.getValue()); } return cl; }
public static Commandline getBaseCommand( String commandName, GitScmProviderRepository repo, ScmFileSet fileSet, String options ) { Settings settings = GitUtil.getSettings(); Commandline cl = new Commandline(); cl.setExecutable( settings.getGitCommand() ); cl.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); if ( settings.getTraceGitCommand() != null ) { cl.addEnvironment( "GIT_TRACE", settings.getTraceGitCommand() ); } cl.createArg().setLine( options ); cl.createArg().setValue( commandName ); return cl; }
public static Commandline getBaseCommand( String commandName, GitScmProviderRepository repo, ScmFileSet fileSet, String options ) { Settings settings = GitUtil.getSettings(); Commandline cl = new Commandline(); cl.setExecutable( settings.getGitCommand() ); cl.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); if ( settings.getTraceGitCommand() != null ) { cl.addEnvironment( "GIT_TRACE", settings.getTraceGitCommand() ); } cl.createArg().setLine( options ); cl.createArg().setValue( commandName ); return cl; }
public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet ) throws ScmException { Commandline command = new Commandline(); command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); try { command.addSystemEnvironment(); } catch ( Exception e ) { throw new ScmException( "Can't add system environment.", e ); } command.addEnvironment( "SSDIR", repo.getVssdir() ); String ssDir = VssCommandLineUtils.getSsDir(); command.setExecutable( ssDir + VssConstants.SS_EXE ); command.createArg().setValue( VssConstants.COMMAND_ADD ); VssCommandLineUtils.addFiles( command, fileSet ); // command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); //User identification to get access to vss repository if ( repo.getUserPassword() != null ) { command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); } //Ignore: Do not ask for input under any circumstances. command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); return command; }
public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet ) throws ScmException { Commandline command = new Commandline(); command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); try { command.addSystemEnvironment(); } catch ( Exception e ) { throw new ScmException( "Can't add system environment.", e ); } command.addEnvironment( "SSDIR", repo.getVssdir() ); String ssDir = VssCommandLineUtils.getSsDir(); command.setExecutable( ssDir + VssConstants.SS_EXE ); command.createArg().setValue( VssConstants.COMMAND_ADD ); VssCommandLineUtils.addFiles( command, fileSet ); // command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); //User identification to get access to vss repository if ( repo.getUserPassword() != null ) { command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); } //Ignore: Do not ask for input under any circumstances. command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); return command; }
public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, String tagName, String message ) throws ScmException { Commandline command = new Commandline(); command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); try { command.addSystemEnvironment(); } catch ( Exception e ) { throw new ScmException( "Can't add system environment.", e ); } command.addEnvironment( "SSDIR", repo.getVssdir() ); String ssDir = VssCommandLineUtils.getSsDir(); command.setExecutable( ssDir + VssConstants.SS_EXE ); command.createArg().setValue( VssConstants.COMMAND_LABEL ); command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); // User identification to get access to vss repository if ( repo.getUserPassword() != null ) { command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); } // Ignore: Do not ask for input under any circumstances. command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); command.createArg().setValue( VssConstants.FLAG_LABEL + tagName ); return command; }
command.addEnvironment( "SSDIR", repo.getVssdir() );
public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, String tagName, String message ) throws ScmException { Commandline command = new Commandline(); command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); try { command.addSystemEnvironment(); } catch ( Exception e ) { throw new ScmException( "Can't add system environment.", e ); } command.addEnvironment( "SSDIR", repo.getVssdir() ); String ssDir = VssCommandLineUtils.getSsDir(); command.setExecutable( ssDir + VssConstants.SS_EXE ); command.createArg().setValue( VssConstants.COMMAND_LABEL ); command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); // User identification to get access to vss repository if ( repo.getUserPassword() != null ) { command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); } // Ignore: Do not ask for input under any circumstances. command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); command.createArg().setValue( VssConstants.FLAG_LABEL + tagName ); return command; }
public Commandline buildSetCurrentProjectCmdLine( VssScmProviderRepository repo ) throws ScmException { Commandline command = new Commandline(); try { command.addSystemEnvironment(); } catch ( Exception e ) { throw new ScmException( "Can't add system environment.", e ); } command.addEnvironment( "SSDIR", repo.getVssdir() ); String ssDir = VssCommandLineUtils.getSsDir(); command.setExecutable( ssDir + VssConstants.SS_EXE ); command.createArg().setValue( VssConstants.COMMAND_CP ); command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); //User identification to get access to vss repository if ( repo.getUserPassword() != null ) { command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); } //Ignore: Do not ask for input under any circumstances. command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); return command; }
public Commandline buildSetCurrentProjectCmdLine( VssScmProviderRepository repo ) throws ScmException { Commandline command = new Commandline(); try { command.addSystemEnvironment(); } catch ( Exception e ) { throw new ScmException( "Can't add system environment.", e ); } command.addEnvironment( "SSDIR", repo.getVssdir() ); String ssDir = VssCommandLineUtils.getSsDir(); command.setExecutable( ssDir + VssConstants.SS_EXE ); command.createArg().setValue( VssConstants.COMMAND_CP ); command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); //User identification to get access to vss repository if ( repo.getUserPassword() != null ) { command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); } //Ignore: Do not ask for input under any circumstances. command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); return command; }
command.addEnvironment( "SSDIR", repo.getVssdir() );