views:

227

answers:

2

When I do a simple delete of the contents of a folder, I get an error:

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

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?

+2  A: 

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?

Scott
If I am not mistaken, Ubuntu has an elevated permissions scheme as well. I could be wrong though. I think you are ultimately right though. I will have to run the build as an elevated user. Thanks!
dbasch
Ubuntu just as 'sudo' hiding under a dialog box. No one would do software development in a tree that required sudo to write into it.
bmargulies
A: 

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

bmargulies
Thanks for the answer.
dbasch