Thursday, December 16, 2010

"Problem: failed to create task or type for" when running Ant

Problem:

My Ant build script had the following:
<loadfile property="allprocesses" srcFile="${someFile}"/>
<for list="${allprocesses}" param="processName" delimiter="${line.separator}">
  <sequential>
    <echo>${processName}</echo>
  </sequential>
</for>
What this does is load some file, and loop through each line in the file.

However, I was getting the following error even though the code is correct:
BUILD FAILED
/home/oracle/scripts/deploy/build.xml:20: Problem: failed to create task or type for
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.
Solution:

1. Add "ant-contrib-1.0b3.jar" to your $ANT_HOME/lib directory.

2. Add the following to the top of your build.xml file:
<taskdef resource="net/sf/antcontrib/antlib.xml" >
  <classpath>
    <pathelement location="${antcontrib}" />
  </classpath>
</taskdef>

7 comments:

Anonymous said...

thanks! this worked perfectly

Anonymous said...

i did this and im still getting the same error is there something wrong im doign

ant home C:\hudson\tools\AntTest\lib in this path i added the ant-contrib-1.0b3.jar file

and then added this to my build file







im using ant 1.8.2 i also add this property to my build.xml file



could you please help me on this?

Anonymous said...

i did this and im still getting the same error is there something wrong im doign

ant home C:\hudson\tools\AntTest\lib in this path i added the ant-contrib-1.0b3.jar file

and then added this to my build file

taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpath
pathelement location="${antcontrib}" /
/classpath
/taskdef

im using ant 1.8.2 i also add this property to my build.xml file

property name="antcontrib" value="/path/to/jar" /

could you please help me on this?

i remove all the "<" and ">" because the text did not appear

Anonymous said...

i also tried with

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

Ahmed Aboulnaga said...

Try checking out my Ant scripts that I just published. They should work for you.

http://blog.ipnweb.com/2011/05/ant-scripts-for-oracle-soa-suite-11g.html

Addy said...

thanks alot ..it worked for me ...awesome. ..ta ta ta

Anonymous said...

I have same problem. I am using Ant 1.8.2 and i tried
taskdef resource="net/sf/antcontrib/antlib.xml"

and taskdef resource="net/sf/antcontrib/antcontrib.properties"

but not worked. After this, i realize ant-contrib-1.0b3.jar is not supported Ant version 1.6 or later. I must use ccp-contrib but how? I don't know. Please help.

Regards.