简体   繁体   中英

ANT delete task and Windows 7 UAC permissions

When I do a simple delete of the contents of a folder,

<delete includeemptydirs="true">
  <fileset dir="${developmentenvironment.www.dir}" includes="**/*"/>
</delete>

I get an error:

C:\Users\...\build.xml:42: Unable to delete file C:\...\www\appserv\AUTHORS.txt  

When, I try to delete the file in the OS, it requires elevated permissions.

I also can't get a UAC prompt by doing this:

<exec executable="cmd">
  <arg value="/c del ./*.*"/>
</exec> 

Can ANT prompt for elevated UAC permissions when using the delete task?

As Ant is designed to be a platform independent build system, I really doubt it provides this very windows-centric functionality. Can you start your build task as a more appropriate user, for instance, one with permission to modify and delete the files needed to complete the build? Alternatively, can you add the user it is running as, recursively, to the permissions on the directory above the one you are trying to delete?

Ant is just a Java program. No JRE will run it that I'm aware of can mess with UAC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM