ant删除任务给出错误

时间:2011-05-20 16:45:05

标签: ant

我想只删存一个目录。

 <target name="clean">
        <delete dir="${COMP_BUILD}" />
    </target>

这会收到错误

clean:
   [delete] Deleting directory U:\id824275_03_2011_06_JUN_ESW\CCS_WSC_ECM\ecm_esw\app\ENT_APP\ESW\bgc-esw-services\build

BUILD FAILED
U:\id824275_03_2011_06_JUN_ESW\CCS_WSC_ECM\ecm_esw\app\BUILD\ESW\ESWBUILD\build.xml:451: The following error occurred while executing this line:
U:\id824275_03_2011_06_JUN_ESW\CCS_WSC_ECM\ecm_esw\app\ENT_APP\ESW\bgc-esw-web\build.xml:207: The following error occurred while executing this line:
U:\id824275_03_2011_06_JUN_ESW\CCS_WSC_ECM\ecm_esw\app\ENT_APP\ESW\bgc-esw-web\build.xml:84: The following error occurred while executing this line:
U:\id824275_03_2011_06_JUN_ESW\CCS_WSC_ECM\ecm_esw\app\ENT_APP\ESW\bgc-esw-services\build.xml:64: Unable to delete directory U:\id824275_03_2011_06_JUN_ESW\CCS_WSC_ECM\ecm_esw\app\ENT_APP\ESW\bgc-esw-services\build\lib

1 个答案:

答案 0 :(得分:4)

您可以指定failonerror

<delete dir="${COMP_BUILD}" failonerror="false"/>

如果目录不存在,这将继续执行。

这样做的问题是,如果目录 存在,但由于其他原因无法删除,那么它仍然会继续。