On 2011-02-15, bool wrote:

> createTask() method is throwing the following error with ant-1.8.2 while it
> works perfectly with Ant 1.7.1.

> import org.apache.tools.ant.taskdefs.Delete;
> Delete delete = (Delete) myProject.createTask("Delete");

> jar:file:/myant/ant-1.8.2/lib/ant.jar!/org/apache/tools/ant/antlib.xml:37:
> Problem: failed to create task or type componentdef

The task is defined in defaults.properties which is inside your ant.jar
in org/apache/tools/ant/taskdefs.

The most likely reason you see this error is that your Java VM has
loaded a different version of ant.jar - one before componentdef was
added as a task - before the one of Ant 1.8.2.  Ant would then load the
properties file from this jar and fail to recognize the task.

> I tried to remove all componentdef stuff from
> org/apache/tools/ant/antlib.xml and then it started working again.

But will cause other problems downstream.  You should rather try to
locate the "other" ant.jar and fix your situation.

One thing to look out for apart from the obvious CLASSPATH environment
variable, ${ANT_HOME}/lib and ~/.ant/lib is the shell script you use to
launch Ant (I assume a Unix like system from ant.jar's path in your
error message).

Ant's own wrapper script contains some modifications for RPM
installations that might pull in other jars depending your local setup
(it might get triggered inside /etc/ant.conf).  What is more likely is
that there is some system installed version of Ant that comes with yet
another wrapper script.

Stefan

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

Reply via email to