tags:

views:

62

answers:

1

I have problem with ant. I woul dlike to use conditions in ant. But i get error of:

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.

and this is code:

<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>
A: 

<if> is an Ant-contrib task. Have you downloaded Ant-contrib and installed it appropriately?

Jon Skeet
yes i already installed ant-contrib
senzacionale
@senzacionale: Well I suspect you haven't installed it properly... but it's slightly hard to tell as you haven't told us which line 412 corresponds to.
Jon Skeet
thx forgot to add <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
senzacionale