How to make Redline RPM Library work with Ant?

2019-03-04 08:14发布

问题:

I use Ant as a build tool, I put this line into my Ant script at the very beginning:

<taskdef name="pure-java-rpm" classname="org.redline_rpm.ant.RedlineTask" classpath="lib/ant/redline-1.1.16.jar" />

I call it further:

<pure-java-rpm group="Games" name="${project-unix-name}" version="0" destination="${destdir}">
        <zipfileset prefix="/usr/share/games/${project-unix-name}" file="${destdir}/${game-jar-filename}"/>
        <depends name="java" version=">= 1.7"/>
    </pure-java-rpm>

I get the following error message: BUILD FAILED /home/gouessej/Documents/programmation/java/workspace/tuer/build.xml:445: java.lang.NoClassDefFoundError: org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream

However, Apache Commons Compress isn't mentioned, it doesn't seem to be a dependency of this library according to the "usage" page. Do I really have to add Apache Commons Compress into the classpath of this task definition to make it work? Is there another solution?

回答1:

The instructions don't mention the dependencies, you need at least SLF4J, Bountycastle, XZ and Apache Commons Compress to use Redline RPM. I've just modified my task definition:

<taskdef name="pure-java-rpm" classname="org.redline_rpm.ant.RedlineTask">
    <classpath>
        <pathelement path="bcpg-jdk15on-151.jar"/>
        <pathelement path="commons-compress-1.8.1.jar"/>
        <pathelement path="slf4j-api-1.7.7.jar"/>
        <pathelement path="slf4j-simple-1.7.7.jar"/>
        <pathelement path="xz-1.4.jar"/>
        <pathelement path="redline-1.1.16.jar"/>
    </classpath>
</taskdef>

You can find those JARs here:

Apache Commons Compress

Bouncycastle

SLF4J

XZ