无法使用ANT脚本删除符号链接

Rij*_*hna 4 ant symlink delete-file

我想使用以下行删除符号链接:

<symlink action="delete"  link="/path/of/link/symlink"/>
Run Code Online (Sandbox Code Playgroud)

它抛出一个错误说:

Could not create tempfile in /directory/where/symlink/points
Run Code Online (Sandbox Code Playgroud)

/ directory/where/symlink/points应该是只读的.有没有办法可以删除符号链接?

Chr*_*ert 7

可以使用<delete>Ant任务删除指向只读资源的符号链接.

<target name="delete-symlink">
  <delete file="/path/of/link/symlink" followsymlinks="false"
          removenotfollowedsymlinks="true" />
</target>
Run Code Online (Sandbox Code Playgroud)

<delete>Ant任务文档:

removeNotFollowedSymlinks  Whether symbolic links (not the files/directories 
                           they link to) should be removed if they haven't been 
                           followed because followSymlinks was false or the 
                           maximum number of symbolic links was too big. Since 
                           Ant 1.8.0