本文整理了Java中org.apache.tools.ant.taskdefs.Delete
类的一些代码示例,展示了Delete
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Delete
类的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Delete
类名称:Delete
[英]Deletes a file or directory, or set of files defined by a fileset. The original delete task would delete a file, or a set of files using the include/exclude syntax. The deltree task would delete a directory tree. This task combines the functionality of these two originally distinct tasks.
Currently Delete extends MatchingTask. This is intended only to provide backwards compatibility for a release. The future position is to use nested filesets exclusively.
[中]删除文件集定义的文件、目录或文件集。原始删除任务将使用include/exclude语法删除一个文件或一组文件。deltree任务将删除目录树。此任务结合了这两个原本截然不同的任务的功能。
当前删除扩展MatchingTask。这只是为了提供版本的向后兼容性。未来的位置是专门使用嵌套文件集。
代码示例来源:origin: org.apache.ant/ant
/**
* Execute the task.
* @throws BuildException if errors occur.
*/
@Override
public void execute() throws BuildException {
if (sources == null) {
throw new BuildException(
"At least one set of source resources must be specified");
}
if (targets == null) {
throw new BuildException(
"At least one set of target files must be specified");
}
//no sources = nothing to compare; no targets = nothing to delete:
if (!sources.isEmpty() && !targets.isEmpty() && !uptodate(sources, targets)) {
log("Deleting all target files.", Project.MSG_VERBOSE);
if (verbose) {
for (String t : targets.list()) {
log("Deleting " + t);
}
}
Delete delete = new Delete();
delete.bindToOwner(this);
delete.add(targets);
delete.perform();
}
}
代码示例来源:origin: org.assertj/assertj-swing-junit
private void delete(File outputFile) {
if (!format.equals(FRAMES))
return;
Delete deleteTask = new Delete();
deleteTask.bindToOwner(task);
deleteTask.setFile(outputFile);
deleteTask.execute();
}
代码示例来源:origin: org.seleniumhq.selenium.server/selenium-server-coreless
/**
* Delete a directory and all subdirectories
*/
public static void recursivelyDeleteDir(File customProfileDir) {
if (customProfileDir == null || !customProfileDir.exists()) {
return;
}
Delete delete = new Delete();
delete.setProject(new Project());
delete.setDir(customProfileDir);
delete.setFailOnError(true);
delete.execute();
}
代码示例来源:origin: org.ow2.jonas/bootstrap-ant
Delete delete = new Delete();
delete.setProject(tempProject);
delete.setFile(src);
delete.execute();
Move mv =new Move();
mv.setProject(tempProject);
代码示例来源:origin: org.metaeffekt.core/ae-inventory-processor
private void removeFolder(String folder, String file) {
final File dir = new File(new File(folder), file);
Delete delete = new Delete();
delete.setDir(dir);
delete.setIncludeEmptyDirs(true);
delete.execute();
System.err.println("Deleting " + file);
}
代码示例来源:origin: org.ow2.jonas/bootstrap-ant
Delete delete = new Delete();
delete.setDir(this.destDir);
delete.execute();
代码示例来源:origin: appfuse/appfuse
/**
* This method will remove files from the source directory.
*
* @param installedDirectory The destination directory to copy to.
* @param removePattern The file pattern to match to locate files to copy.
*/
protected void removeGeneratedFiles(final String installedDirectory, final String removePattern) {
Delete deleteTask = (Delete) antProject.createTask("delete");
FileSet fileSet = AntUtils.createFileset(installedDirectory, removePattern, new ArrayList());
log("Removing generated files (pattern: " + removePattern + ")...");
deleteTask.addFileset(fileSet);
deleteTask.execute();
}
代码示例来源:origin: joel-costigliola/assertj-swing
private void delete(File outputFile) {
if (!format.equals(FRAMES))
return;
Delete deleteTask = new Delete();
deleteTask.bindToOwner(task);
deleteTask.setFile(outputFile);
deleteTask.execute();
}
代码示例来源:origin: org.testatoo.openqa/selenium-server
/**
* Delete a directory and all subdirectories
*/
public static void recursivelyDeleteDir(File customProfileDir) {
if (customProfileDir == null || !customProfileDir.exists()) {
return;
}
Delete delete = new Delete();
delete.setProject(new Project());
delete.setDir(customProfileDir);
delete.setFailOnError(true);
delete.execute();
}
代码示例来源:origin: org.apache.ant/ant-commons-net
Delete mydelete = new Delete();
mydelete.bindToOwner(task);
mydelete.setFile(tempFile.getCanonicalFile());
mydelete.execute();
} catch (Exception e) {
throw new BuildException(e, task.getLocation());
代码示例来源:origin: org.metaeffekt.dcc/dcc-commons
Delete delete = new Delete();
delete.setProject(getAntProject());
delete.setIncludes(FILE_PATTERN_CERT);
delete.setDir(targetChainDir);
delete.execute();
代码示例来源:origin: de.unkrig/antology
Delete mydelete = new Delete();
mydelete.bindToOwner(this);
mydelete.setFile(tempFile.getCanonicalFile());
mydelete.execute();
} catch (Exception e) {
throw new BuildException(e, getLocation());
代码示例来源:origin: org.metaeffekt.core/ae-inventory-processor
Delete delete = new Delete();
delete.setProject(project);
delete.setDir(scanDirectory);
delete.execute();
代码示例来源:origin: com.github.goldin/maven-common
Delete mydelete = new Delete();
mydelete.bindToOwner(this);
mydelete.setFile(tempFile.getCanonicalFile());
mydelete.execute();
} catch (Exception e) {
throw new BuildException(e, getLocation());
代码示例来源:origin: org.apache.ant/ant-commons-net
Delete mydelete = new Delete();
mydelete.bindToOwner(this);
mydelete.setFile(tempFile.getCanonicalFile());
mydelete.execute();
} catch (Exception e) {
throw new BuildException(e, getLocation());
代码示例来源:origin: org.apache.ant/ant-junit
task.log("Transform time: " + dt + "ms");
if (format.equals(FRAMES)) {
Delete delete = new Delete();
delete.bindToOwner(task);
delete.setFile(outputFile);
delete.execute();
内容来源于网络,如有侵权,请联系作者删除!