如何为ant安装org.apache.tools.ant.taskdefs.optional.Rpm

时间:2014-01-08 10:08:22

标签: java ant

我正试图推出:

ant rpm

命令,其中第126行的build.xml如下所示:

<rpm specFile="whatever.spec" topDir="${basedir}/rpm" command="-bb" failOnError="true" />

我收到了错误:

build.xml:126: Problem: failed to create task or type rpm
Cause: the class org.apache.tools.ant.taskdefs.optional.Rpm was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/export/home/myuser/.ant/lib
        -a directory added on the command line with the -lib argument

我下载了ant-nodeps-1.7.1.jar,其中包含:

jar tvf ant-nodeps-1.7.1.jar | grep Rpm
  7171 Fri Jun 27 05:03:48 CEST 2008 org/apache/tools/ant/taskdefs/optional/Rpm.class

我把这个jar文件放到了目录:/ usr / share / ant / lib

ant-1.7.0.jar -> ../../java/ant-1.7.0.jar
ant.jar -> ../../java/ant.jar
ant-launcher-1.7.0.jar -> ../../java/ant-launcher-1.7.0.jar
ant-launcher.jar -> ../../java/ant-launcher.jar
ant-nodeps-1.7.1.jar

但仍然遇到了构建错误。 我也试过命令:

ant -lib /usr/share/ant/lib rpm
ant -lib /usr/share/ant/lib/ant-nodeps-1.7.1.jar rpm
ant -lib ant-nodeps-1.7.1.jar rpm

没有成功,得到同样的错误。 缺少什么,我需要做什么?

谢谢!

1 个答案:

答案 0 :(得分:0)

进入您的ANT_HOME目录并运行ant -f fetch.xml -Ddest=system 这将下载ant rpm所需的可选ant依赖项。

这来自ant install guide