org.apache.tools.ant.types.Path.toString()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.tools.ant.types.Path.toString()方法的一些代码示例,展示了Path.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.toString()方法的具体详情如下:
包路径:org.apache.tools.ant.types.Path
类名称:Path
方法名:toString

Path.toString介绍

[英]Returns a textual representation of the path, which can be used as CLASSPATH or PATH environment variable definition.
[中]返回路径的文本表示形式,可以用作类路径或路径环境变量定义。

代码示例

代码示例来源:origin: apache/groovy

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());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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();
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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()};
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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();
}

代码示例来源:origin: org.apache.ant/ant

/**
   * Override the project working directory.
   *
   * @param   localPath   The path on disk.
   */
  public void setLocalpath(Path localPath) {
    this.localPath = localPath.toString();
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Override the project working directory.
 *
 * @param   localPath   The path on disk.
 */
public void setLocalpath(Path localPath) {
  super.setInternalLocalPath(localPath.toString());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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();
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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();
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Override the project working directory.
 *
 * @param   localPath   The path on disk.
 */
public void setLocalpath(Path localPath) {
  super.setInternalLocalPath(localPath.toString());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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();
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Override the project working directory.
 *
 * @param   localPath   The path on disk.
 */
public void setLocalpath(Path localPath) {
  super.setInternalLocalPath(localPath.toString());
}

代码示例来源:origin: pmd/pmd

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);
  }
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * 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)
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * 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)
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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()};
}

代码示例来源:origin: Sable/soot

private void addPath(String option, Path path) {
  if( path.size() == 0 ) return;
  addArg(option);
  addArg(path.toString());
}
private List phaseopts = new ArrayList();

代码示例来源:origin: checkstyle/checkstyle

@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));
}

代码示例来源:origin: checkstyle/checkstyle

@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());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
  }
}

相关文章