I want to use ANT script to delete a file.
For some reason the following script gives me the following message:
BUILD SUCCESSFUL
Total time: 0 seconds
The script I am running is:
<?xml version="1.0"?>
<project name="UpdateFlag">
<target name="deleteFlag">
&开发者_运维技巧lt;delete file="/state/update.flag" failonerror="true"/>
</target>
</project>
Please assist.
<delete file="/state/update.flag" failonerror="true"/>
Will delete the file that's is in the state directory that's on the root of your directory structure. In Unix, it would be /state/update.flag
, and in Windows (on the C: drive), it would be C:\state\update.flag
. Is this where the file is located?
When in doubt, run Ant with the -d
and -v
switches. This will print out lots of useful information (and tons of useless garbage). For example, did your delete task find a file to delete? If the file isn't there, the <delete>
task won't fail.
I have a funny feeling that you actually meant to do:
<delete file="${basedir}/state/update.flag"
failonerror="true"/>
精彩评论