📜  Apache Ant删除任务

📅  最后修改于: 2020-12-26 13:54:05             🧑  作者: Mango

Apache Ant删除任务

此任务用于删除单个文件,目录或子目录。我们还可以通过指定文件集来删除文件集。默认情况下,它不会删除空目录,我们需要使用includeEmptyDirs属性来删除该目录。

它具有下表列出的各种属性。

Apache Ant删除任务属性

Attribute Description Required
file The file to be deleted Resource (file,directory)
dir The directory to delete.
verbose Whether to show the name of each deleted file. No
quiet If resource is not exist, it does not display any message. No
failonerror It displays error on fail to delete the resource. No
includeemptydirs Delete empty directory too. No
includes List of files to be deleted. No
includesfile Includes file to be deleted. No
excludes Exclude file to delete. No
excludesfile Exclude to delete file. No
defaultexcludes Set default exclude. No
deleteonexit Delete on exit. No
removeNotFollowedSymlinks Whether symbolic links (not the files/directories they link to) should be removed. No
performGCOnFailedDelete If Ant fails to delete a file or directory it will retry the operation once. No

Apache Ant删除示例

让我们看一个例子来了解删除任务的功能。

删除档案


    
        
    

删除目录


    
        
    

删除所有。当前目录和子目录中的java文件。


    
        
             
        
    

删除构建的所有文件和子目录,甚至构建本身。