执行Ant任务时出现问题

Ant*_*nto 4 apache ant

我已经安装了Apache Ant并正确设置了Path,CLASS_PATH和ANT_PATH变量.当我在build.xml文件所在的项目文件夹中的命令行中运行jar任务时,出现以下错误:

BUILD FAILED

C:\Documents and Settings\TonyS\My Documents\My Workspace\code\build.xml: 32:

The following error occurred while executing this line:
jar:file:/C:/Documents%20and%20Settings/TonyS/My%20Documents/Ant/apache-ant-1.8.1/lib/ant.jar!org/apache/tools/ant/antlib.xml:37: Could not create task or type: componentdef.

Ant could not find the task or a class this task relies upon.

....
Run Code Online (Sandbox Code Playgroud)

可以请有人给我一个帮助,因为这让我发疯...

谢谢!

Pet*_*son 5

我有这个错误,发现它是由类路径中的旧版本的ant.jar引起的.


Rag*_*ram 4

ant一种可能性是您的系统上可能安装了另一个版本并且您PATH指向它。

检查ANT_HOME设置的内容。

运行ant -version看看是否显示1.8.1