我想做这样的事情
<target name="clean" description="clean">
<if>
<available file="${build}" type="dir" />
<then>
<delete dir="${build}" />
</then>
</if>
</target>
根据 suggestions在 stackoverflow.com 上找到,我下载了 ant-contrib-1.0b3.jar 并将其放入我的路径中
此外,在 Ant Build 配置下,在类路径中,我有
运行我的 ANT 脚本时,我仍然得到
BUILD FAILED
C:\Repositories\blah\build.xml:60: Problem: failed to create task or type if
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
我错过了什么?请指教
最佳答案
或者,一次可以在您的 ANT 脚本中包含以下行
<taskdef resource="net/sf/antcontrib/antlib.xml" />
只要
ant-contribs
就在你的路上,不需要其他任何东西这个解决方案更干净一点,作为一个 获得对所有标签的访问权,不仅仅是手动指定的那些
关于ANT:使用条件标签,<IF>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6336792/