的build.xml
<?xml version="1.0"?>
<project default="main" basedir=".">
<echo message="pulling in property files" />
<property file="axis_bujava.properties" />
<echo message="calling the RPM Build Ant" />
<target name="main">
<rpm specfile="example.spec" topdir="${basedir}" command="-bs" />
</target>
</project>
example.spec
Summary: xxx
Name: cdplayer
Version: 1.0
Release: 1
Copyright: xxx
Group: Applications/Sound
Source: xxx.tgz
URL: http://xxx.html
Distribution: xxxx
Vendor:xxx.
Packager: xxx
%description
xxxx
%build
make
%install
make install
输出:
Buildfile: /home/user1/workspace/antdemo/build.xml
[echo] pulling in property files
[echo] calling the RPM Build Ant
main:
[rpm] Building the RPM based on the example.spec file
[rpm] -bs: unknown option
[rpm] 'rpm' failed with exit code 1
BUILD SUCCESSFUL
Total time: 848 milliseconds
答案 0 :(得分:3)
我也有这个问题。在我的情况下,操作系统没有安装'rpmbuild'命令,因此ant任务正在调用'rpm',而不是Aaron建议的。
答案 1 :(得分:0)
虽然我不确定“-bs”选项是什么,但您可以尝试将其更改为“-bb”,这是默认设置。我自己的构建,加上我见过的一些,通常使用-bb(http://richardfriedman.blogspot.com/2007/02/rpm-java-and-frustration.html)