本文整理匯總了Java中org.apache.tools.ant.types.Path.append方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.append方法的具體用法?Java Path.append怎麽用?Java Path.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tools.ant.types.Path
的用法示例。
在下文中一共展示了Path.append方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: compile
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private void compile() {
Javac j = new Javac();
j.setProject(getProject());
j.setTaskName("compile");
j.setSrcdir(new Path(getProject(), sources_path));
File tmp;
if (classes_path != null) {
tmp = getProject().resolveFile(classes_path);
if (!tmp.exists()) {
if (!tmp.mkdir())
throw new BuildException("Could not create temporary folder " + tmp.getAbsolutePath());
}
} else {
// Generate temporary folder
java.nio.file.Path p = mktemp();
temporary.add(p);
tmp = p.toFile();
classes_path = tmp.getAbsolutePath();
}
j.setDestdir(tmp);
// See "Setting Java Compiler Options" in User Guide
j.setDebug(true);
if (jckit.version == JC.V212) {
j.setTarget("1.1");
j.setSource("1.1");
// Always set debug to disable "contains local variables,
// but not local variable table." messages
j.setDebug(true);
} else if (jckit.version == JC.V221) {
j.setTarget("1.2");
j.setSource("1.2");
} else {
j.setTarget("1.5");
j.setSource("1.5");
}
j.setIncludeantruntime(false);
j.createCompilerArg().setValue("-Xlint");
j.createCompilerArg().setValue("-Xlint:-options");
j.createCompilerArg().setValue("-Xlint:-serial");
j.setFailonerror(true);
j.setFork(true);
// set classpath
Path cp = j.createClasspath();
String api = null;
if (jckit.version == JC.V3) {
api = Paths.get(jckit.path, "lib", "api_classic.jar").toAbsolutePath().toString();
} else if (jckit.version == JC.V212) { // V2.1.X
api = Paths.get(jckit.path, "lib", "api21.jar").toAbsolutePath().toString();
} else { // V2.2.X
api = Paths.get(jckit.path, "lib", "api.jar").toAbsolutePath().toString();
}
cp.append(new Path(getProject(), api));
for (JCImport i : raw_imports) {
// Support import clauses with only jar or exp values
if (i.jar != null) {
cp.append(new Path(getProject(), i.jar));
}
}
j.execute();
}
示例2: appendPath
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
/**
* Append path to class path if the appened path is not empty and is not null
*
* @param cp the path to modify
* @param p the path to append
*/
private void appendPath(Path cp, final Path p) {
if (p != null && p.size() > 0) {
cp.append(p);
}
}