开发者

ANT delete task and Windows 7 UAC permissions

开发者 https://www.devze.com 2022-12-22 11:57 出处:网络
When I do a simple delete of the contents of a folder, <delete includeemptydirs=\"true\"> <fileset dir=\"${developmentenvironment.www.dir}\" includes=\"**/*\"/>

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 del开发者_如何学Goete 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消