Examples of DefaultExecutor


Examples of org.apache.commons.exec.DefaultExecutor

                log.info("Process execution complete, exit code=" + result);
            }
        };

        final String vmOptions = System.getProperty("jar.executor.vm.options");
        final Executor e = new DefaultExecutor();
        if (this.workingDirectory != null) {
            e.setWorkingDirectory(this.workingDirectory);
        }
        final CommandLine cl = new CommandLine(javaExecutable);
        if (vmOptions != null && vmOptions.length() > 0) {
            // TODO: this will fail if one of the vm options as a quoted value with a space in it, but this is
            // not the case for common usage patterns
            for (String option : StringUtils.split(vmOptions, " ")) {
                cl.addArgument(option);
            }
        }
        cl.addArgument("-jar");
        cl.addArgument(jarToExecute.getAbsolutePath());
        cl.addArgument("-p");
        cl.addArgument(String.valueOf(serverPort));
        log.info("Executing " + cl);
        e.setStreamHandler(new PumpStreamHandler());
        e.setProcessDestroyer(new ShutdownHookProcessDestroyer());
        e.execute(cl, h);
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

          if ( arguments != null ) {
            line += " " + arguments;
          }

          CommandLine commandLine = CommandLine.parse(line);
          DefaultExecutor executor = new DefaultExecutor();
          int exitValue = executor.execute(commandLine);
         
          if ( exitValue != 0 ) {
              throw new MojoExecutionException( "Problem executing light, return code " + exitValue );
          }
        
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

          }

          line += " " + paths;
         
          CommandLine commandLine = CommandLine.parse(line);
          DefaultExecutor executor = new DefaultExecutor();
          int exitValue = executor.execute(commandLine);
         
          if ( exitValue != 0 ) {
              throw new MojoExecutionException( "Problem executing candle, return code " + exitValue );
          }
        
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

{
    protected int executeCommandLine( String line )
        throws ExecuteException, IOException
    {
        CommandLine commandLine = CommandLine.parse( line );
        DefaultExecutor executor = new DefaultExecutor();
        return executor.execute( commandLine );
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

    private void packageApplication() throws MojoExecutionException {
        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArgument("package");
        DefaultExecutor executor = new DefaultExecutor();

        if (timeout > 0) {
            ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
            executor.setWatchdog(watchdog);
        }

        executor.setWorkingDirectory(project.getBasedir());
        executor.setExitValue(0);
        try {
            executor.execute(cmdLine, getEnvironment());
        } catch (IOException e) {
            throw new MojoExecutionException("Error during packaging", e);
        }
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

    private void packageDistribution() throws MojoExecutionException {
        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArgument("dist");
        DefaultExecutor executor = new DefaultExecutor();

        if (timeout > 0) {
            ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
            executor.setWatchdog(watchdog);
        }

        executor.setWorkingDirectory(project.getBasedir());
        executor.setExitValue(0);
        try {
            executor.execute(cmdLine, getEnvironment());
        } catch (IOException e) {
            throw new MojoExecutionException("Error during distribution creation", e);
        }
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

        CommandLine cmdLine = CommandLine.parse(line);

        cmdLine.addArgument("debug");
        cmdLine.addArguments(getPlay2SystemPropertiesArguments(), false);
        cmdLine.addArgument("run");
        DefaultExecutor executor = new DefaultExecutor();

        // As where not linked to a project, we can't set the working directory.
        // So it will use the directory where mvn was launched.

        executor.setExitValue(0);
        try {
            executor.execute(cmdLine, getEnvironment());
        } catch (IOException e) {
            // Ignore.
        }
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArguments(getPlay2SystemPropertiesArguments(), false);
        cmdLine.addArgument("run");
        DefaultExecutor executor = new DefaultExecutor();

        // As where not linked to a project, we can't set the working directory.
        // So it will use the directory where mvn was launched.

        executor.setExitValue(0);
        try {
            executor.execute(cmdLine, getEnvironment());
        } catch (IOException e) {
            // Ignore.
        }
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArgument("compile");
        DefaultExecutor executor = new DefaultExecutor();

        if (timeout > 0) {
            ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
            executor.setWatchdog(watchdog);
        }

        executor.setExitValue(0);
        executor.setWorkingDirectory(project.getBasedir());
        try {
            executor.execute(cmdLine, getEnvironment());
        } catch (IOException e) {
            throw new MojoExecutionException("Error during compilation", e);
        }
    }
View Full Code Here

Examples of org.apache.commons.exec.DefaultExecutor

        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArguments(getPlay2SystemPropertiesArguments(), false);
        cmdLine.addArgument("test");
        DefaultExecutor executor = new DefaultExecutor();

        if (timeout > 0) {
            ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
            executor.setWatchdog(watchdog);
        }

        executor.setWorkingDirectory(project.getBasedir());

        executor.setExitValue(0);
        try {
            executor.execute(cmdLine, getEnvironment());
        } catch (IOException e) {
            if (testFailureIgnore) {
                getLog().error("Test execution failures ignored");
            } else {
                throw new MojoExecutionException("Error during compilation", e);
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.