2
votes

I have migrated Ant1.7 to 1.8.2. Getting follwing warning in my eclipse as:

The following error occurred while executing this line:

jar:file:/C:/software/apache-ant-1.8.2/lib/ ant.jar!/org/apache/tools/ant/antlib.xml:37: Problem: failed to create task or type componentdef Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/ types have been declared. Action: Check that any / declarations have taken place.

from my build.xml importing another build xml file as:

<import file="../../../BUILD/ESW/ESWBUILD/build-utils.xml"/>

Analysis:

1)if i point to 1.7, error doesnt occur.
2) Open build.xml, modify something and save, after saving error is gone.

How can I solve above issue?

2

2 Answers

3
votes

It sounds like you might have multiple versions of Ant in your classpath, and the older one is picked up first, but then it also tries to load the descriptor for 1.8.1, which will result in this sort of error. I would check the following:

  • Check your CLASSPATH and ensure that it is set to the newer version of ant, and does not include the older version of ant
  • Run ant -version and ensure it is using ant 1.8.1
  • Check the version of ant that eclipse is using and ensure it is using the correct path as well
  • If this is a grails application, and you are using an older version of grails, you may need to update it - see this question. It's possible other frameworks might have similar problems, but I'd need to know more about your application to say for certain.
  • If none of this solves your problem, you could try temporarily removing ant 1.7. If some component then complains that it cant find that version, then you will have to update that component to use 1.8.1 instead.
0
votes

I ran into the same issue and there is a ant packaged with one of the vendor jars that I included. Removed the vendor jar and it fixed it