【发布时间】:2011-04-23 21:31:30
【问题描述】:
我已经安装了 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.
【问题讨论】:
-
Componentdef.class 和 Jar.class 在 ant.jar 本身中找到。您的 ant.jar 是否已损坏 - 大小是否为 1.4 Mb 左右?
-
我假设你说的是
PATH(不是Path)、CLASSPATH(不是CLASS_PATH)和ANT_HOME(不是ANT_PATH)环境变量? -
我不记得了,那是差不多 7 年前的事了..