Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Execute


            if (! f.exists() || !f.isDirectory())
                throw new BuildException("\""+ f.getPath() + "\" does not represent a valid directory. JDepend would fail.");
            commandline.createArgument().setValue(f.getPath());
        }
       
        Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), watchdog);       
        execute.setCommandline(commandline.getCommandline());
        if (getDir() != null) {
            execute.setWorkingDirectory(getDir());
            execute.setAntRun(project);
        }

        if (getOutputFile() != null)
            log("Ouptut to be stored in " + getOutputFile().getPath());
        log("Executing: "+commandline.toString(), Project.MSG_VERBOSE);
        try {
            return execute.execute();
        } catch (IOException e) {
            throw new BuildException("Process fork failed.", e, location);
        }
    }
View Full Code Here


                log("Compilation arguments:", Project.MSG_VERBOSE);
                log(DefaultGroovyMethods.join(commandLine, "\n"), Project.MSG_VERBOSE);

                if (fork) {
                    // use the main method in FileSystemCompiler
                    final Execute executor = new Execute(); // new LogStreamHandler ( attributes , Project.MSG_INFO , Project.MSG_WARN ) ) ;
                    executor.setAntRun(getProject());
                    executor.setWorkingDirectory(getProject().getBaseDir());
                    executor.setCommandline(commandLine);
                    try {
                        executor.execute();
                    }
                    catch (final IOException ioe) {
                        throw new BuildException("Error running forked groovyc.", ioe);
                    }
                    final int returnCode = executor.getExitValue();
                    if (returnCode != 0) {

                        if (failOnError) {
                            throw new BuildException("Forked groovyc returned error code: " + returnCode);
                        } else {
View Full Code Here

      if (jmProperty.isValid()) {
        cmd.createArgument().setValue("-J" + jmProperty.toString());
      }
    }

    Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN));
    execute.setCommandline(cmd.getCommandline());
    execute.setAntRun(getProject());

    execute.setWorkingDirectory(new File(jmeterHome.getAbsolutePath() + File.separator + "bin"));
    log(cmd.describeCommand(), Project.MSG_VERBOSE);

    try {
      execute.execute();
    }
    catch (IOException e) {
      throw new BuildException("JMeter execution failed.", e, getLocation());
    }
  }
View Full Code Here

  {
    Commandline cmdline = getCommandline();
   
    prepCommandline();
   
    Execute runner = createExecute(project, cmdline,
      workingDirectory);
   
    execExecuteTask(failMsg, runner);
  }
View Full Code Here

    File workingDirectory)
  {
   
    ExecuteStreamHandler streamHandler = createStreamHandler();
   
    Execute runner = new Execute(streamHandler, null);
   
    if(workingDirectory != null)
    {
      runner.setWorkingDirectory(workingDirectory);
    }
   
    setPythonPathInExecute(runner);
   
    runner.setAntRun(project);
    runner.setCommandline(cmdline.getCommandline());
    return runner;
  }
View Full Code Here

                    toExecute.createArgument().setValue(srcFiles[i]);
                }
            }
        }

        Execute exe = new Execute(this);
        exe.setCommandline(toExecute.getCommandline());
        exe.setAntRun(project);
        exe.setWorkingDirectory(this.cvsWorkingDirectory);
        try {
            exe.execute();
        } catch (IOException e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

    }


    protected int run(Commandline cmd, ExecuteStreamHandler handler) {
        try {           
            Execute exe = new Execute(handler);
            exe.setAntRun(getProject());                        
            exe.setWorkingDirectory(getProject().getBaseDir());
            exe.setCommandline(cmd.getCommandline());
            return exe.execute();
        }
        catch (java.io.IOException e) {
            throw new BuildException(e, location);
        }
    }
View Full Code Here

        m_serverPath = serverPath;
    }

    protected int run(Commandline cmd) {
        try {
            Execute exe = new Execute(new LogStreamHandler(this,
                                                           Project.MSG_INFO,
                                                           Project.MSG_WARN));

            // If location of ss.ini is specified we need to set the
            // environment-variable SSDIR to this value
            if (m_serverPath != null) {
                String[] env = exe.getEnvironment();
                if( env == null ) {
                    env = new String[0];
                }
                String[] newEnv = new String[env.length+1];
                for( int i=0;i<env.length;i++ ) {
                    newEnv[i] = env[i];
                }
                newEnv[env.length] = "SSDIR=" + m_serverPath;

                exe.setEnvironment(newEnv);
            }
           
            exe.setAntRun(project);
            exe.setWorkingDirectory(project.getBaseDir());
            exe.setCommandline(cmd.getCommandline());
            return exe.execute();
        } catch (java.io.IOException e) {
            throw new BuildException(e, location);
        }
    }
View Full Code Here


    protected int run(Commandline cmd) {
        try {
            Project aProj = getProject();
            Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN));
            exe.setAntRun(aProj);
            exe.setWorkingDirectory(aProj.getBaseDir());
            exe.setCommandline(cmd.getCommandline());
            return exe.execute();
        }
        catch (java.io.IOException e) {
            throw new BuildException(e, location);
        }
    }
View Full Code Here

        final Commandline.Argument arg = cmdl.createVmArgument();
        arg.setValue("-mx140M");
        arg.setValue("-Dinstall.root="+javaccHome.getAbsolutePath());

        final Execute process =
            new Execute(new LogStreamHandler(this,
                                             Project.MSG_INFO,
                                             Project.MSG_INFO),
                        null);
        log(cmdl.toString(), Project.MSG_VERBOSE);
        process.setCommandline(cmdl.getCommandline());

        try {
            if (process.execute() != 0) {
                throw new BuildException("JJTree failed.");
            }
        }
        catch (IOException e) {
            throw new BuildException("Failed to launch JJTree: " + e);
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Execute

Copyright © 2018 www.massapicom. 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.