Package org.codehaus.plexus.util.cli

Examples of org.codehaus.plexus.util.cli.Commandline.addEnvironment()


                    if ( nameValue.length < 2 )
                    {
                        throw new MojoFailureException( "   Misformed env: '" + env[i] + "'" );
                    }
                    dbg.println( "   '" + nameValue[0] + "=" + nameValue[1] + "'" );
                    cmdLine.addEnvironment( nameValue[0], nameValue[1] );
                }
            }

            Process process = cmdLine.execute();
            StreamGobbler errorGobbler = new StreamGobbler( process.getErrorStream(), err );
View Full Code Here


        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Can't add system environment variables to mvn command line.", e );
        }
        cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
        cl.setExecutable( "mvn" );
        cl.setWorkingDirectory( determineWorkingDirectoryPath( this.getCheckoutDirectory(),
                                                               relativePathProjectDirectory, goalsDirectory ) );

        if ( this.goals != null )
View Full Code Here

            Map<String, String> environments = getEnvVars( profile );
            // no null check we use a private method just here
            for ( String key : environments.keySet() )
            {
                String value = environments.get( key );
                commandline.addEnvironment( key, value );
            }

            executable = executable.append( executorConfigurator.getExecutable() );
            commandline.setExecutable( executable.toString() );
            commandline.addArguments( new String[]{executorConfigurator.getVersionArgument()} );
View Full Code Here

    {
        Commandline cl = new Commandline();

        cl.setPid( idCommand );

        cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );

        if ( environments != null && !environments.isEmpty() )
        {
            for ( String key : environments.keySet() )
            {
View Full Code Here

        if ( environments != null && !environments.isEmpty() )
        {
            for ( String key : environments.keySet() )
            {
                String value = environments.get( key );
                cl.addEnvironment( key, value );
            }
        }

        cl.addSystemEnvironment();
View Full Code Here

            Commandline commandline = new Commandline();
            if ( StringUtils.isNotEmpty( path ) )
            {
                executable.append( path ).append( File.separator );
                executable.append( executorConfigurator.getRelativePath() ).append( File.separator );
                commandline.addEnvironment( executorConfigurator.getEnvVar(), path );
            }
            //Installations are env var they must be add if exists
            Map<String, String> environments = getEnvVars( profile );
            // no null check we use a private method just here
            for ( String key : environments.keySet() )
View Full Code Here

                    if ( nameValue.length < 2 )
                    {
                        throw new MojoFailureException( "   Misformed env: '" + env[i] + "'" );
                    }
                    dbg.println( "   '" + nameValue[0] + "=" + nameValue[1] + "'" );
                    cmdLine.addEnvironment( nameValue[0], nameValue[1] );
                }
            }

            Process process = cmdLine.execute();
            StreamGobbler errorGobbler = new StreamGobbler( process.getErrorStream(), err );
View Full Code Here

    };

    final File mvnInstallDir = new File(bundle.getParentFile(), "apache-maven-3.0.3");

    Commandline cl = new Commandline();
    cl.addEnvironment("M2_HOME", mvnInstallDir.getCanonicalPath());
    cl.setWorkingDirectory(getTestFile("m3"));
    cl.setExecutable(new File(mvnInstallDir, "bin/mvn").getCanonicalPath());
    cl.createArg().setValue("install");
    cl.createArg().setValue("-s");
    cl.createArg().setValue(getOverridableFile("settings.xml").getCanonicalPath());
View Full Code Here

    };

    File mvnInstallDir = new File(bundle.getParentFile(), "maven-2.0.6");

    Commandline cl = new Commandline();
    cl.addEnvironment("M2_HOME", mvnInstallDir.getCanonicalPath());
    cl.setWorkingDirectory(getTestFile("m2"));
    cl.setExecutable(new File(mvnInstallDir, "bin/mvn").getCanonicalPath());
    cl.createArg().setValue("install");
    cl.createArg().setValue("-s");
    cl.createArg().setValue(getOverridableFile("settings.xml").getCanonicalPath());
View Full Code Here

    cl.createArg().setValue("-s");
    cl.createArg().setValue(getOverridableFile("settings.xml").getCanonicalPath());
    final File repo = new File(getTestFile("m2"), "repo");
    cl.createArg().setValue("-Dmaven.repo.local=" + repo.getCanonicalPath());
    final String m2Home = new File(bundle.getParentFile(), "maven-2.0.6").getAbsolutePath();
    cl.addEnvironment("M2_HOME", m2Home);
    int exit = CommandLineUtils.executeCommandLine(cl, out, out);

    assertEquals(sb.toString(), exit, 0);
    assertThat(sb.toString(), containsString("nexus4218/md-test/0.1-SNAPSHOT/md-test-0.1-20110415.143359-7.pom"));
    assertThat(sb.toString(), containsString("nexus4218/md-test/0.1-SNAPSHOT/md-test-0.1-20110415.143359-7.txt"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.