ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@ryano.us
Subject Ant 1.7.0 specific error: failed to create task or type taskdef
Date Wed, 30 May 2007 14:47:53 GMT
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 this.

                String fooName = "foo";
                Ant antV = new Ant();
                Target foo = new Target();
                verify.setName(fooName);
                proj.addTarget(foo);
                foo.addTask(antV);
                foo.setProject(proj);
                antV.setProject(proj);
                antV.init();
                antV.setDir(fBin);
                antV.setAntfile("build.xml");
                antV.setTarget(fooName);

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 org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:541)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:369)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)


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

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.
--ryano


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message