Apache Compress Antlib User Manual

This Antlib contains tasks and resources that provide compression/uncompression and archival/unarchival capabilities based on Apache Commons Compress. Using Apache Commons Compress 1.6 this Antlib supports gzip, bzip2, lzma standalone, xz, .Z, Snappy and pack200 compression and ar, arj, cpio, 7z, Unix dump, tar and zip archives. Support for lzma, arj, .Z, Snappy and dump is read-only. 7z can only be used on filesystem resources.

Known Limitations

Reading AR archives from non-filesystem resources currently fails for reasons that haven't been investigated, yet. Most likely the problem is within Apache Commons Compress.

Tasks and Types

This Antlib contains the following tasks:

This Antlib contains the following resources:

This Antlib contains the following conditions that work on the *entry-resources of this Antlib as well as their counterparts in Ant itself:

Installing and Using

This Antlib requires Apache Ant 1.8.0 or higher, Apache Commons Compress 1.6 or higher and Java5 or higher.

If you are building the Antlib from sources, run the antlib target and you'll get a file ant-compress-VERSION.jar. If you've downloaded a binary release, you are already there.

In order to use the Antlib, you can either use taskdef or rely on Ant's autodiscovery by using an XML namespace and the Antlib's URI. The taskdef approach allows you to specify a custom classpath while you must make sure Ant finds the Antlib itself as well as Apache Commons Compress - either because it is in a well known place like $ANT_HOME/lib or using the -lib command line option - when using autodiscovey.

The taskdef approach

Before you can use any of the tasks or resources you must use a taskdef task like:

      <taskdef 
        uri="antlib:org.apache.ant.compress"
        resource="org/apache/ant/compress/antlib.xml">
        <classpath>
          <pathelement location="YOUR-PATH-TO/ant-compress-VERSION1.jar"/>
          <pathelement location="YOUR-PATH-TO/commons-compress-VERSION2.jar"/>
        </classpath>
      </taskdef>

And later use something like:

      <comp:tar
        xmlns:tar="antlib:org.apache.ant.compress"
        ...

The autodiscovery approach

      <project
        xmlns:comp="antlib:org.apache.ant.compress"
        ...

And later use something like:

          <comp:tar
            ...