2010-05-12 80 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