private void processError(Exception e) { Writer writer = new StringBuilderWriter(); new ErrorReporter(e, false).write(new PrintWriter(writer)); String message = writer.toString(); throw new BuildException("Script Failed: " + message, e, getLocation()); }
/** * stringify path and assign to the value. * The value will contain all path elements separated by the appropriate * separator * @param path path */ public void setPath(Path path) { this.value = path.toString(); }
/** * Set a single commandline argument and treats it like a * PATH--ensuring the right separator for the local platform * is used. * * @param value a single commandline argument. */ public void setPath(Path value) { parts = new String[] {value.toString()}; }
/** * Override the working directory and get to the specified path. * * @param path The new localPath value. */ public final void setLocalPath(Path path) { localPath = path.toString(); }
/** * Override the project working directory. * * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { this.localPath = localPath.toString(); } }
/** * Override the project working directory. * * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { super.setInternalLocalPath(localPath.toString()); }
/** * Determine whether the classpath has been specified, and whether it shall * really be used or be nulled by build.sysclasspath. * @return true if the classpath is to be used. * @since Ant 1.6 */ public boolean haveClasspath() { Path fullClasspath = classpath == null ? null : classpath.concatSystemClasspath("ignore"); return fullClasspath != null && !fullClasspath.toString().trim().isEmpty(); }
/** * Determine whether the modulepath has been specified. * @return true if the modulepath is to be used. * @since 1.9.7 */ public boolean haveModulepath() { Path fullClasspath = modulepath != null ? modulepath.concatSystemClasspath("ignore") : null; return fullClasspath != null && !fullClasspath.toString().trim().isEmpty(); }
/** * Override the project working directory. * * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { super.setInternalLocalPath(localPath.toString()); }
/** * Determine whether the upgrademodulepath has been specified. * @return true if the upgrademodulepath is to be used. * @since 1.9.7 */ public boolean haveUpgrademodulepath() { Path fullClasspath = upgrademodulepath != null ? upgrademodulepath.concatSystemClasspath("ignore") : null; return fullClasspath != null && !fullClasspath.toString().trim().isEmpty(); }
/** * Override the project working directory. * * @param localPath The path on disk. */ public void setLocalpath(Path localPath) { super.setInternalLocalPath(localPath.toString()); }
private void setupClassLoader() { try { if (auxClasspath != null) { project.log("Using auxclasspath: " + auxClasspath, Project.MSG_VERBOSE); configuration.prependClasspath(auxClasspath.toString()); } } catch (IOException ioe) { throw new BuildException(ioe.getMessage(), ioe); } }
/** * Adds a reference to a sourcepath defined elsewhere. * * @param r * reference to a sourcepath defined elsewhere */ public void setAuxClasspathRef(Reference r) { Path path = createAuxClasspath(); path.setRefid(r); path.toString(); // Evaluated for its side-effects (throwing a // BuildException) }
/** * Adds a reference to a classpath defined elsewhere. * * @param r * reference to a classpath defined elsewhere */ public void setClasspathRef(Reference r) { Path path = createClasspath(); path.setRefid(r); path.toString(); // Evaluated for its side-effects (throwing a // BuildException) }
/** * Set a single commandline argument from a reference to a * path--ensuring the right separator for the local platform * is used. * * @param value a single commandline argument. */ public void setPathref(Reference value) { Path p = new Path(getProject()); p.setRefid(value); parts = new String[] {p.toString()}; }
private void addPath(String option, Path path) { if( path.size() == 0 ) return; addArg(option); addArg(path.toString()); } private List phaseopts = new ArrayList();
@Test public void testSetClasspath() { final CheckstyleAntTask antTask = new CheckstyleAntTask(); final Project project = new Project(); final String path1 = "firstPath"; final String path2 = "secondPath"; antTask.setClasspath(new Path(project, path1)); antTask.setClasspath(new Path(project, path2)); assertNotNull("Classpath should not be null", Whitebox.getInternalState(antTask, "classpath")); final Path classpath = Whitebox.getInternalState(antTask, "classpath"); assertTrue("Classpath contain provided path", classpath.toString().contains(path1)); assertTrue("Classpath contain provided path", classpath.toString().contains(path2)); }
@Test public void testCreateClasspath() { final CheckstyleAntTask antTask = new CheckstyleAntTask(); assertEquals("Invalid classpath", "", antTask.createClasspath().toString()); antTask.setClasspath(new Path(new Project(), "/path")); assertEquals("Invalid classpath", "", antTask.createClasspath().toString()); }
/** * launch the generate client using system api. * @throws BuildException if there is an error. */ protected void executeForkV5() throws BuildException { try { log("mode : fork " + BorlandDeploymentTool.BES, Project.MSG_DEBUG); ExecTask execTask = new ExecTask(this); execTask.setDir(new File(".")); execTask.setExecutable("iastool"); if (debug) { execTask.createArg().setValue("-debug"); } execTask.createArg().setValue("-genclient"); execTask.createArg().setValue("-jars"); // ejb jar file execTask.createArg().setValue(ejbjarfile.getAbsolutePath()); //client jar file execTask.createArg().setValue("-target"); execTask.createArg().setValue(clientjarfile.getAbsolutePath()); //classpath execTask.createArg().setValue("-cp"); execTask.createArg().setValue(classpath.toString()); log("Calling iastool", Project.MSG_VERBOSE); execTask.execute(); } catch (Exception e) { // Have to catch this because of the semantics of calling main() throw new BuildException("Exception while calling generateclient", e); } }
/** * Verify the produced jar file by invoking the Borland iastool tool * @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 = 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() throw new BuildException("Exception while calling generateclient Details: ", e); } }