Package net.sourceforge.cruisecontrol.util

Examples of net.sourceforge.cruisecontrol.util.Commandline


        set.setProject(project);
        String libjars = set.toString();
        libjars = libjars.replaceAll("jar" + File.pathSeparator, "jar" + File.pathSeparator + libDir);
        libjars = libDir + libjars;

        final Commandline cmdLine = new Commandline();
        cmdLine.addArguments(args);
        Commandline.Argument argClasspath = cmdLine.createArgument();
        argClasspath.setLine("-classpath " + "conf" + File.pathSeparator + libjars);

        Commandline.Argument argStart = cmdLine.createArgument();
        argStart.setLine("-jar lib/start.jar");

        Commandline.Argument argProg = cmdLine.createArgument();
        argProg.setValue("conf/start-jini.config"); // ${jini.config}

        cmdLine.setExecutable(getJavaExec());

        LOG.debug("jini startup command: " + Arrays.asList(cmdLine.getCommandline()));
        final Process newJiniProcess = Runtime.getRuntime().exec(cmdLine.getCommandline());

        // show what's happening with the jiniProcess
        new Thread(new StreamPumper(newJiniProcess.getErrorStream(),
                new PrefixedPrintWriter("[JiniErr] "))).start();
        new Thread(new StreamPumper(newJiniProcess.getInputStream(),
View Full Code Here


     *  construct the command that we're going to execute.
     *  @return Commandline holding command to be executed
     * @throws CruiseControlException
     */
    public Commandline buildCommandline() throws CruiseControlException {
        Commandline cmdLine = new Commandline();

        if (mavenScript != null) {
            cmdLine.setExecutable(mavenScript);
        } else {
            throw new CruiseControlException(
                "Non-script running is not implemented yet.\n"
                    + "As of 1.0-beta-10 Maven startup mechanism is still changing...");
        }

        Iterator propertiesIterator = buildProperties.keySet().iterator();
        while (propertiesIterator.hasNext()) {
            String key = (String) propertiesIterator.next();
            cmdLine.createArgument().setValue("-D" + key + "=" + buildProperties.get(key));
        }

        if (LOG.isDebugEnabled()) {
            cmdLine.createArgument().setValue("-X");
        }

        cmdLine.createArgument().setValue("-b"); // no banner
        if (projectFile != null) {
            // we need only the name of the file
            File pFile = new File(projectFile);
            cmdLine.createArgument().setValue("-p");
            cmdLine.createArgument().setValue(pFile.getName());
        }
        if (goalset != null) {
            StringTokenizer stok = new StringTokenizer(goalset, " \t\r\n");
            while (stok.hasMoreTokens()) {
                cmdLine.createArgument().setValue(stok.nextToken());
            }
        }

        if (LOG.isDebugEnabled()) {
            StringBuffer sb = new StringBuffer();
            sb.append("Executing Command: ");
            String[] args = cmdLine.getCommandline();
            for (int i = 0; i < args.length; i++) {
                String arg = args[i];
                sb.append(arg);
                sb.append(" ");
            }
View Full Code Here

            bwr.close();
        } catch (IOException ioex) {
            fail("Unexpected IOException while preparing " + testFile.getAbsolutePath() + " test file");
        }
        if (!onWindows) {
            Commandline cmdline = new Commandline();
            cmdline.setExecutable("chmod");
            cmdline.createArgument().setValue("755");
            cmdline.createArgument().setValue(testFile.getAbsolutePath());
            try {
                Process p = cmdline.execute();
                p.waitFor();
            } catch (Exception e) {
                e.printStackTrace();
                fail("exception changing permissions on test file " + testFile.getAbsolutePath());
            }
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.util.Commandline

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.