我正在尝试安装 Apache Ivy,并且已经下载了二进制文件。以下是问题:如何安装 ant 和 ivy?,以及此处的说明:http://ant.apache.org/ivy/history/2.3.0/install.html我已将二进制文件从下载目录移出,如下所示:
sudo cp ivy-2.3.0.jar /usr/share/ant/lib/ivy.jar
然而,当我从 hello-ivy 示例运行 ant 时,我仍然得到:
apache-ivy-2.3.0/src/example/hello-ivy/build.xml:38: Problem: failed to create task or type antlib:org.apache.ivy.ant:retrieve
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.
No types or tasks have been defined in this namespace yet
我也尝试过把它放在 $HOME/.ant/lib 中。我也尝试过如下方式运行:
ant -lib /usr/share/ant/lib
我正在运行带有 Ant 1.7.1 的 CentOS6.4。
它是显示在我的类路径中。来自 ant -diagnostics:
java.class.path:/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/antlr.jar:/usr/share/java/ant/ant-antlr.jar:/usr/share/java/bcel.jar:/usr/share/java/ant/ant-apache-bcel.jar:/usr/share/java/bsf.jar:/usr/share/java/ant/ant-apache-bsf.jar:/usr/share/java/log4j.jar:/usr/share/java/ant/ant-apache-log4j.jar:/u sr/share/java/oro.jar:/usr/share/java/ant/ant-apache-oro.jar:/usr/share/java/regexp.jar:/usr/share/java/ant/ant-apache-regexp.jar:/usr/share/java/xml-commons-resolver.jar:/usr/share/java/ant/ant-apache-resolver.jar:/usr/share/java/jakarta-commons-logging.jar:/usr/share/java/ant/ant-commons-logging.jar:/usr/share/java/jakarta-commons-net.jar:/usr/share/java/ant/ant-commons-net.jar:/usr/s hare/java/javamail.jar:/usr/share/java/jaf.jar:/usr/share/java/ant/ant-javamail.jar:/usr/share/java/jdepend.jar:/usr/share/java/ant/ant-jdepend.jar:/usr/share/java/jsch.jar:/usr/share/java/ant/ant-jsch.jar:/usr/share/java/junit.jar:/usr/share/java/ant/ant-junit.jar:/usr/share/java/ant/ant-nodeps.jar:/usr/share/java/ant/ant-swing.jar:/usr/share/java/jaxp_transform_impl.jar:/usr/share/ja va/ant/ant-trax.jar:/usr/share/java/xalan-j2-serializer.jar:/usr/lib/jvm/java/lib/tools.jar:/home/jteems/.ant/lib/ivy.jar:/usr/share/ant/lib/ant-apache-resolver.jar:/usr/share/ant/lib/ant-apache-regexp.jar:/usr/share/ant/lib/ant-javamail.jar:/usr/share/ant/lib/ant-apache-bsf.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-apache-log4j.jar:/usr/share/ant/lib/ivy.jar:/usr/share/ant/lib/ant-commons-logging.jar:/usr/share/ant/lib/ant-jdepend.jar:/usr/share/ant/lib/ant-nodeps.jar:/usr/share/ant/lib/ant-swing.jar:/usr/share/ant/lib/ant-jsch.jar:/usr/share/ant/lib/ant-trax.jar:/usr/share/ant/lib/ant-commons-net.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant-bootstrap.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-apache-bcel.jar:/usr/share/ant/lib/ant-apache-oro.jar
全部失败。有人有什么想法吗?
答案1
这个问题似乎与 ant 的版本 (1.7.1) 或我使用的 CentOS/RedHat RPM 版本有关。根据邮件列表,http://www.mail-archive.com/[电子邮件保护]/msg05766.html,RPM 版本存在一个已知问题。我在我的机器上安装了最新版本的 ant (1.9),一切运行正常。