Package org.apache.tools.ant.taskdefs

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


     *
     * @throws Exception Indicates an error executing the target {@link ExecTask}.
     */
    private void startOpenOfficeServer() throws Exception
    {
        ExecTask execTask = (ExecTask) this.project.createTask("exec");
        Commandline commandLine =
            new Commandline(OPENOFFICE_EXECUTABLE
                + " -headless -accept=\"socket,host=127.0.0.1,port=8100;urp;\" -nofirststartwizard");
        execTask.setCommand(commandLine);
        execTask.execute();
    }
View Full Code Here


     * @param sourceJar java.io.File representing the produced jar file
     */
    private void verifyBorlandJarV5(File sourceJar) {
        log("verify BES " + sourceJar, Project.MSG_INFO);
        try {
            ExecTask execTask = null;
            execTask = new ExecTask(getTask());
            execTask.setDir(new File("."));
            execTask.setExecutable("iastool");
            //classpath
            if (getCombinedClasspath() != null)  {
                execTask.createArg().setValue("-VBJclasspath");
                execTask.createArg().setValue(getCombinedClasspath().toString());
            }

            if (java2iiopdebug) {
                execTask.createArg().setValue("-debug");
            }
            execTask.createArg().setValue("-verify");
            execTask.createArg().setValue("-src");
            // ejb jar file to verify
            execTask.createArg().setValue(sourceJar.getPath());
            log("Calling iastool", Project.MSG_VERBOSE);
            execTask.execute();
        } catch (Exception e) {
            // Have to catch this because of the semantics of calling main()
            String msg = "Exception while calling generateclient Details: "
                + e.toString();
            throw new BuildException(msg, e);
View Full Code Here

     * it appears in the logs to be the same task as this one.
     * @return the delegate.
     * @throws BuildException on error.
     */
    protected ExecTask createExec() throws BuildException {
        ExecTask exec = new ExecTask(this);
        return exec;
    }
View Full Code Here

                throw new BuildException(msg, getLocation());
            }
        } else {
            try {
                File listFile = createListFile(files);
                ExecTask exec = createExec();
                File outFile = null;

                // die if cabarc fails
                exec.setFailonerror(true);
                exec.setDir(baseDir);

                if (!doVerbose) {
                    outFile = FILE_UTILS.createTempFile("ant", "", null, true, true);
                    exec.setOutput(outFile);
                }

                exec.setExecutable("cabarc");
                exec.createArg().setValue("-r");
                exec.createArg().setValue("-p");

                if (!doCompress) {
                    exec.createArg().setValue("-m");
                    exec.createArg().setValue("none");
                }

                if (cmdOptions != null) {
                    exec.createArg().setLine(cmdOptions);
                }

                exec.createArg().setValue("n");
                exec.createArg().setFile(cabFile);
                exec.createArg().setValue("@" + listFile.getAbsolutePath());

                exec.execute();

                if (outFile != null) {
                    outFile.delete();
                }
View Full Code Here

    /**
     * Create a new exec delegate.  The delegate task is populated so that
     * it appears in the logs to be the same task as this one.
     */
    protected ExecTask createExec() throws BuildException {
        ExecTask exec = (ExecTask) project.createTask("exec");
        exec.setOwningTarget(this.getOwningTarget());
        exec.setTaskName(this.getTaskName());
        exec.setDescription(this.getDescription());

        return exec;
    }
View Full Code Here

                throw new BuildException(msg);
            }
        } else {
            try {
                File listFile = createListFile(files);
                ExecTask exec = createExec();
                File outFile = null;

                // die if cabarc fails
                exec.setFailonerror(true);
                exec.setDir(baseDir);

                if (!doVerbose) {
                    outFile = fileUtils.createTempFile("ant", "", null);
                    exec.setOutput(outFile);
                }

                exec.setCommand(createCommand(listFile));
                exec.execute();

                if (outFile != null) {
                    outFile.delete();
                }
View Full Code Here

    /**
     * Create a new exec delegate.  The delegate task is populated so that
     * it appears in the logs to be the same task as this one.
     */
    protected ExecTask createExec() throws BuildException {
        ExecTask exec = (ExecTask) getProject().createTask("exec");
        exec.setOwningTarget(this.getOwningTarget());
        exec.setTaskName(this.getTaskName());
        exec.setDescription(this.getDescription());

        return exec;
    }
View Full Code Here

                throw new BuildException(msg, getLocation());
            }
        } else {
            try {
                File listFile = createListFile(files);
                ExecTask exec = createExec();
                File outFile = null;

                // die if cabarc fails
                exec.setFailonerror(true);
                exec.setDir(baseDir);

                if (!doVerbose) {
                    outFile = fileUtils.createTempFile("ant", "", null);
                    outFile.deleteOnExit();
                    exec.setOutput(outFile);
                }

                exec.setExecutable("cabarc");
                exec.createArg().setValue("-r");
                exec.createArg().setValue("-p");

                if (!doCompress) {
                    exec.createArg().setValue("-m");
                    exec.createArg().setValue("none");
                }

                if (cmdOptions != null) {
                    exec.createArg().setLine(cmdOptions);
                }

                exec.createArg().setValue("n");
                exec.createArg().setFile(cabFile);
                exec.createArg().setValue("@" + listFile.getAbsolutePath());

                exec.execute();

                if (outFile != null) {
                    outFile.delete();
                }
View Full Code Here

     * @return output of the command line
     */
    protected String runS(Commandline cmdline) {
        String   outV  = "opts.cc.runS.output" + pcnt++;
        Project  aProj = getProject();
        ExecTask exe   = (ExecTask) aProj.createTask("exec");
        Commandline.Argument arg = exe.createArg();

        exe.setExecutable(cmdline.getExecutable());
        arg.setLine(cmdline.toString(cmdline.getArguments()));
        exe.setOutputproperty(outV);
        exe.execute();
        // System.out.println( "runS: " + outV + " : " + aProj.getProperty( outV ));

        return aProj.getProperty(outV);
    }
View Full Code Here

    }
   
    /** Kill processes by name */
    public static void killByName(String name) {
        Project p = new Project();
        ExecTask exec = new ExecTask();
        exec.setProject(p);
        exec.setExecutable("taskkill");
        Environment.Variable path = new Environment.Variable();
        path.setKey(getExactPathEnvKey());
        path.setFile(findWBEM());
        exec.addEnv(path);
        exec.setTaskType("taskkill");
        exec.setFailonerror(false);
        exec.createArg().setValue("/f");
        exec.createArg().setValue("/im");
        exec.createArg().setValue(name);
        exec.setResultProperty("result");
        exec.setOutputproperty("output");
        exec.execute();
        String result = p.getProperty("result");
        String output = p.getProperty("output");
        log.info(output);
        if (!"0".equals(result)) {
            throw new WindowsRegistryException("exec return code " + result + ": " + output);
View Full Code Here

TOP

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

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.