Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
Ant 1.7.0 specific error: failed to create task or type taskdef

Ant 1.7.0 specific error: failed to create task or type taskdef

2007-05-30       - By ryan@(protected)

Hey Folks,

We recently upgraded from Ant 1.6.5 to Ant 1.7.0.  We noticed that code in our
build listener that functioned properly in Ant 1.5.x through Ant 1.6.5 no
longer works with 1.7.  The code basically adds some targets to a top level
build file so if users invoke ant in a sub-directory with no build file, or
there is a build file without the specified target, then the listener invokes
the target added to the top level build file.  The code looks something like

               String fooName = "foo";
               Ant antV = new Ant();
               Target foo = new Target();

Everything builds properly but at runtime we get the following error when
invoking foo:

The following error occurred while executing this line:
/home/ryano/svn-ws/spider/bin/build.xml:11: Problem: failed to create task or
type taskdef
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.

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
       at sun.reflect.DelegatingMethodAccessorImpl.invoke
       at java.lang.reflect.Method.invoke(

We also see this error in front of the stack trace but I don't think this is an

Could not load definitions from resource org/apache/tools/ant/antlib.xml. It
could not be found.

I googled about for awhile and searched the email archive but came up empty.  I
saw some threads with similar issues but the solution to those issues seemed to
be adding missing task impls to the ant lib directory.   Just seems odd that
the core Ant tasks can not be found.

Switching back to Ant 1.6.5 solves the problem but I'd like to understand the
issue and if there are any work arounds for this.  I know we could use the
recently added import task but this would require a large scale change to the
source base which is a little risky right now.

Any help appreciated.  Thanks in advance.

To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.