Packs a resource using the GZip, BZip2 or XZ algorithm. The output file is only generated if it doesn't exist or the source resource is newer.

XZ compression support has been added with Apache Ant 1.10.1 and depends on external libraries not included in the Ant distribution. See Library Dependencies for more information.


Attribute Description Required
src the file to gzip/bzip/xz. Yes, or a nested resource collection.
destfile the destination file to create. Exactly one of the two
zipfile the deprecated old name of destfile.

any resource or single element resource collection

The specified resource will be used as src. Since Apache Ant 1.7


<gzip src="test.tar" destfile="test.tar.gz"/>
<bzip2 src="test.tar" destfile="test.tar.bz2"/>
<xz src="test.tar" destfile="test.tar.xz"/>
<gzip destfile="archive.tar.gz">
  <url url="http://example.org/archive.tar"/>

downloads http://example.org/archive.tar and compresses it to archive.tar.gz in the project's basedir on the fly.