2010-05-12 83 views
0

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

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> 
+2

你刚刚用**图片**代替了你的代码吗?现在你如何期待有人来测试呢? – 2010-05-12 13:36:12

+0

yes becouse我无法添加代码。如果我复制代码没有代码显示在计算器中。 – senzacionale 2010-05-12 17:59:29

+0

这只意味着你没有正确添加它。选择代码,然后按Ctrl-K或单击代码图标以正确格式化。 – 2010-05-12 18:05:54

回答

0

<if>是一个Ant-的contrib任务。您是否已经下载了Ant-contrib并进行了适当的安装?

+0

是的,我已经安装了ant-contrib – senzacionale 2010-05-12 18:00:00

+0

@senzacionale:我怀疑你没有正确安装它......但有点难以分辨,因为你没有告诉我们哪一行412对应。 – 2010-05-12 18:06:57

+0

thx忘了添加 senzacionale 2010-05-13 05:38:27