GZip/BZip2/XZ

Description

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 since Apache Ant 1.10.1 and depends on external libraries not included in the Ant distribution. See Library Dependencies for more information.

Parameters

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 deprecated old name of destfile.

Parameters specified as nested elements

any resource or single element resource collection

Since Apache Ant 1.7

The specified resource will be used as src.

Examples

<gzip src="test.tar" destfile="test.tar.gz"/>
<bzip2 src="test.tar" destfile="test.tar.bz2"/>
<xz src="test.tar" destfile="test.tar.xz"/>

Download https://example.org/archive.tar and compress it to archive.tar.gz in the project's basedir on the fly.

<gzip destfile="archive.tar.gz">
  <url url="https://example.org/archive.tar"/>
</gzip>