蚂蚁条件问题

时间:2010-05-12 13:29:54

标签: java ant

我有蚂蚁的问题。我想在蚂蚁中使用条件。但我得到错误:

BUILD FAILED
C:\Projekti\Projekt ANT\build.xml:412: Problem: failed to create task or type
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.

这是代码:

<target name="test">

<input message="Write some text: " addproperty="foo" />

<if>
 <equals arg1="${foo}" arg2="bar" />
 <then>
   <echo message="The value of property foo is 'bar'" />
 </then>

 <elseif>
  <equals arg1="${foo}" arg2="foo" />
  <then>
   <echo message="The value of property foo is 'foo'" />
  </then>
 </elseif>


 <else>
   <echo message="The value of property foo is not 'foo' or 'bar'" />
 </else>
</if>

</target> 

</project>

1 个答案:

答案 0 :(得分:0)

<if>是一个Ant-contrib任务。您是否下载了Ant-contrib并正确安装了它?