我正在尝试使用以下内容检查 ant 中是否存在属性:
<target name="test">
<property name="testproperty" value="1234567890"/>
<if>
<isset property="testproperty"/>
<then>
<echo message="testproperty exists"/>
</then>
<else>
<echo message="testproperty does not exist"/>
</else>
</if>
</target>
结果是消息失败:
build.xml:536: 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.
我一定对isset做错了,因为以下运行顺利:
<target name="test">
<property name="testproperty" value="1234567890"/>
<echo message="'${testproperty}'"/>
</target>
请指教 :)