failed to create task or type if

ant, apache

Solution

Ant needs antcontrib on path, then use :

<project xmlns:ac="antlib:net.sf.antcontrib">

<ac:if>
...
</ac:if>

</project>

or :

<project>

<taskdef resource="net/sf/antcontrib/antlib.xml"/>

<if>
...
</if>

</project>

When using several ant addons, the installation via namespaces is to be preferred. To keep your ant core installation clean, don't put antcontrib.jar in %ANT_HOME%\lib, create a folder for ant addon jars instead and use something like that to start your ant scripts : Windows

@ echo off

set ANT_ARGS=-lib C:\path\to\ant\extralibs
set ANT_HOME=C:\path\to\ant
set ANT_OPTS=-Xmx1024m
set JAVA_HOME=%ProgramFiles(x86)%\JavaSoft\JDK\1.7.0_60
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%

:: DEFAULT
call ant -f %1

:: DEBUG
:call ant -debug -Dfoo=bar -f %1

pause

Linux/Unix => don't forget the quotationmarks on the ANT_ARGS line !

  ...
  ANT_ARGS="-lib /usr/local/ant_xtralibs:/usr/local/ant_testlibs"
  export ANT_ARGS
  ...

Problem

I am getting the following error ``` failed to create task or type target ``` Linux OS Ant Version is 1.7.1 Is there any jar that i must include in the ant library for this type? Below is my part of my Build.xml code ``` <target name="wrapFiles"> <fileset dir="${proc_src_path}" id="src.sql"> <exclude name="**/.svn/**"/> </fileset> <echo message="Initiating Wrap" /> <echo message="${src.sql}" /> <pathconvert pathsep="," property="sql.files.present" refid="src.sql"/> <if> <equals arg1="${sql.files.present}" arg2="" /> <then> <echo message="No file found. Skipping Wrapping of files." /> </then> <else> <echo message="Files found. Proceeding with wrapping of files" /> <foreach target="wrapFile" param="toWrap"> <path> <fileset dir="${proc_src_path}" casesensitive="yes"> <exclude name="**/*.txt"/> <exclude name="**/*.TXT"/> <exclude name="**/pkg_*_spec.SQL"/> <exclude name="**/pkg_*_spec.sql"/> <exclude name="**/PKG_*_SPEC.sql"/> <exclude name="**/PKG_*_SPEC.SQL"/> <exclude name="**/*.svn/**"/> </fileset> </path> </foreach> </else> </if> </target> ```

Original source

Related problems