/** * Return the list of environment variables */ public String[] getEnvironmentVariables() throws CommandLineException { try { addSystemEnvironment(); } catch ( Exception e ) { throw new CommandLineException( "Error setting up environmental variables", e ); } String[] environmentVars = new String[envVars.size()]; int i = 0; for ( Object o : envVars.keySet() ) { String name = (String) o; String value = envVars.get( name ); environmentVars[i] = name + "=" + value; i++; } return environmentVars; }
private void addSystemEnvironmentVariables(Commandline cl, boolean add) { if (add) { try { cl.addSystemEnvironment(); } catch (Exception e) { throw illegalState(e); } } }
@Override public Commandline createCommandLine( String executable ) throws MavenExecutorException { Commandline commandline = new Commandline(); commandline.setExecutable( executable ); try { commandline.addSystemEnvironment(); } catch ( Exception e ) { throw new MavenExecutorException( e.getMessage(), e ); } return commandline; } }
protected Commandline getCommandLine(ExecContext context) { Commandline cl = new Commandline(); cl.setExecutable(context.getExecutable()); if (context.isAddSystemEnvironment()) { try { cl.addSystemEnvironment(); } catch (Exception e) { throw new IllegalStateException(e); } } if (context.getArgs() != null) { cl.addArguments(CollectionUtils.toStringArray(context.getArgs())); } if (context.getWorkingDirectory() != null) { cl.setWorkingDirectory(context.getWorkingDirectory()); } return cl; }
public void reset() { // TODO find out why Commandline allows executable, args etc to be initialised to // null, but not allowing them to be reset to null. This results is weird "clear" // behaviour. It is just safer to start again. cl = new Commandline(); commandLines = new StringBuilder(); errorOutput = new StringBuilder(); systemErr = new ErrorConsumer( getLogger(), errorOutput ); cl.getShell().setQuotedArgumentsEnabled( true ); cl.setExecutable( executable ); try { cl.addSystemEnvironment(); } catch ( Exception e ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Unable to obtain system environment", e ); } else { getLogger().warn( "Unable to obtain system environment" ); } } }
public void reset() { // TODO find out why Commandline allows executable, args etc to be initialised to // null, but not allowing them to be reset to null. This results is weird "clear" // behaviour. It is just safer to start again. cl = new Commandline(); commandLines = new StringBuilder(); errorOutput = new StringBuilder(); systemErr = new ErrorConsumer( getLogger(), errorOutput ); cl.getShell().setQuotedArgumentsEnabled( true ); cl.setExecutable( executable ); try { cl.addSystemEnvironment(); } catch ( Exception e ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Unable to obtain system environment", e ); } else { getLogger().warn( "Unable to obtain system environment" ); } } }
protected Commandline getCommandLine(MvnContext context) throws Exception { Commandline cl = new Commandline(); cl.setExecutable(getMvnExecutable(context.getExecutable())); cl.setWorkingDirectory(context.getBasedir()); if (context.isAddEnvironment()) { cl.addSystemEnvironment(); } addMavenOpts(context, cl); addArgs(cl, context.getArgs()); addProperties(context, cl, context.getProperties()); 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; }
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.addSystemEnvironment();
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.addSystemEnvironment();
command.addSystemEnvironment();