本文整理汇总了Java中org.apache.tools.ant.taskdefs.Delete.setProject方法的典型用法代码示例。如果您正苦于以下问题:Java Delete.setProject方法的具体用法?Java Delete.setProject怎么用?Java Delete.setProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.taskdefs.Delete
的用法示例。
在下文中一共展示了Delete.setProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unZip
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
public static void unZip(String zipPath,String targetFolder,boolean cleanZip){
File folderFile =new File(targetFolder);
File zipFile = new File(zipPath);
Project prj = new Project();
Expand expand = new Expand();
expand.setEncoding("UTF-8");
expand.setProject(prj);
expand.setSrc(zipFile);
expand.setOverwrite(true);
expand.setDest(folderFile);
expand.execute();
if(cleanZip){
//清除zip包
Delete delete = new Delete();
delete.setProject(prj);
delete.setDir(zipFile);
delete.execute();
}
}
示例2: recursivelyDeleteDir
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
/**
* 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();
}
示例3: testWithoutPreviousResolveAndNonDefaultCache
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
@Test
public void testWithoutPreviousResolveAndNonDefaultCache() {
File cache2 = new File("build/cache2");
cache2.mkdirs();
try {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
fileset.setSetid("simple-setid");
System.setProperty("ivy.cache.dir", cache2.getAbsolutePath());
fileset.execute();
Object ref = project.getReference("simple-setid");
assertNotNull(ref);
assertTrue(ref instanceof FileSet);
FileSet fs = (FileSet) ref;
DirectoryScanner directoryScanner = fs.getDirectoryScanner(project);
assertEquals(1, directoryScanner.getIncludedFiles().length);
assertEquals(
getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar", cache2)
.getAbsolutePath(), new File(directoryScanner.getBasedir(),
directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
} finally {
Delete del = new Delete();
del.setProject(new Project());
del.setDir(cache2);
del.execute();
}
}
示例4: tearDown
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
@After
public void tearDown() {
TestHelper.cleanCache();
Delete del = new Delete();
del.setProject(new Project());
del.setDir(new File("build/test/retrieve"));
del.execute();
}
示例5: tearDown
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
@After
public void tearDown() {
IvyContext.popContext();
Delete del = new Delete();
del.setProject(new Project());
del.setDir(cacheManager.getRepositoryCacheRoot());
del.execute();
}
示例6: clean
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
private void clean(File tempDirectory) {
Delete cleanupTask = new Delete();
cleanupTask.setProject(getProject());
cleanupTask.setTaskName(getTaskName());
cleanupTask.setLocation(getLocation());
cleanupTask.setDir(tempDirectory);
cleanupTask.perform();
}
示例7: deleteDir
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
private static void deleteDir(Project project, File dir) {
Delete deleteTask = new Delete();
deleteTask.setProject(project);
deleteTask.setTaskName("delete dir");
deleteTask.setDir(dir);
deleteTask.execute();
}
示例8: deleteFile
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
private static void deleteFile(Project project, File file) {
Delete deleteTask = new Delete();
deleteTask.setProject(project);
deleteTask.setTaskName("delete file");
deleteTask.setFile(file);
deleteTask.execute();
}
示例9: cleanupTestDir
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
@After
public void cleanupTestDir() {
Delete delete = new Delete();
delete.setProject(new Project());
delete.setDir(testDir);
delete.setQuiet(true);
delete.setIncludeEmptyDirs(true);
delete.execute();
}
示例10: deleteFolder
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
public static void deleteFolder(File folder) {
if (folder.exists()) {
Delete delete = new Delete();
delete.setProject(new Project());
delete.setDir(folder);
delete.setIncludeEmptyDirs(true);
delete.setQuiet(true);
delete.execute();
}
}
示例11: cleanUpStaleClasses
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
/**
* See issue #166888. If there are any existing class files with no matching
* source file, assume this is an incremental build and the source file has
* since been deleted. In that case, delete the whole classes dir. (Could
* merely delete the stale class file, but if an annotation processor also
* created associated resources, these may be stale too. Kill them all and
* let JSR 269 sort it out.)
*/
private void cleanUpStaleClasses() {
File d = getDestdir();
if (!d.isDirectory()) {
return;
}
List<File> sources = new ArrayList<>();
for (String s : getSrcdir().list()) {
sources.add(new File(s));
}
if (generatedClassesDir.isDirectory()) {
sources.add(generatedClassesDir);
}
FileSet classes = new FileSet();
classes.setDir(d);
classes.setIncludes("**/*.class");
classes.setExcludes("**/*$*.class");
String startTimeProp = getProject().getProperty("module.build.started.time");
Date startTime;
try {
startTime = startTimeProp != null ? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse(startTimeProp) : null;
} catch (ParseException x) {
throw new BuildException(x);
}
for (String clazz : classes.getDirectoryScanner(getProject()).getIncludedFiles()) {
if (startTime != null && new File(d, clazz).lastModified() > startTime.getTime()) {
// Ignore recently created classes. Hack to get contrib/j2ee.blueprints and the like
// to build; these generate classes and resources before main compilation step.
continue;
}
String java = clazz.substring(0, clazz.length() - ".class".length()) + ".java";
boolean found = false;
for (File source : sources) {
if (new File(source, java).isFile()) {
found = true;
break;
}
}
if (!found) {
// XXX might be a false negative in case this was a nonpublic outer class
// (could check for "ClassName.java" in bytecode to see)
log(new File(d, clazz) + " appears to be stale, rebuilding all module sources", Project.MSG_WARN);
Delete delete = new Delete();
delete.setProject(getProject());
delete.setOwningTarget(getOwningTarget());
delete.setLocation(getLocation());
FileSet deletables = new FileSet();
deletables.setDir(d);
delete.addFileset(deletables);
delete.init();
delete.execute();
break;
}
}
}
示例12: cleanTestDir
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
private void cleanTestDir() {
Delete del = new Delete();
del.setProject(new Project());
del.setDir(new File("build/test/deliver"));
del.execute();
}
示例13: cleanRetrieveDir
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
private void cleanRetrieveDir() {
Delete del = new Delete();
del.setProject(new Project());
del.setDir(new File("build/test/retrieve"));
del.execute();
}
示例14: cleanRep
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
private void cleanRep() {
Delete del = new Delete();
del.setProject(new Project());
del.setDir(new File("test/repositories/1/apache"));
del.execute();
}
示例15: cleanCache
import org.apache.tools.ant.taskdefs.Delete; //导入方法依赖的package包/类
public static void cleanCache() {
Delete del = new Delete();
del.setProject(new Project());
del.setDir(cache);
del.execute();
}