blob: f088610f033449f184b1d716ec18c78d797ec435 [file] [log] [blame]
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Uncompressing Tasks</title>
<h2><a name="unpack">Uncompressing Tasks</a></h2>
<p>For each of the supported compression formats there is a
correspondig task that uncompresses a resource. These tasks are
based on
their <a href="">core
cousin tasks</a>.</p>
<p>If <i>dest</i> is a directory the name of the destination file is
the same as <i>src</i> (with the compression specific
extension removed if present). If <i>dest</i> is omitted, the parent
dir of <i>src</i> is taken. The file is only expanded if the source
resource is newer than the destination file, or when the destination file
does not exist.</p>
<table border="1" cellpadding="2" cellspacing="0">
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
<td valign="top">src</td>
<td valign="top">the file to expand.</td>
<td align="center" valign="top">Yes, or a nested resource collection.</td>
<td valign="top">dest</td>
<td valign="top">the destination file or directory.</td>
<td align="center" valign="top">No</td>
<h3>Parameters specified as nested elements</h3>
<h4>any <a href="">resource</a> or single element
resource collection</h4>
<p>The specified resource will be used as src.</p>
<h3><a name="bunzip2">BUnZip2</a></h3>
<p>Is an <a href="#unpack">uncompressing task</a> that uses the BZIP2
compression algorithm.</p>
<h3><a name="gunzip">GUnZip</a></h3>
<p>Is an <a href="#unpack">uncompressing task</a> that uses the GZIP
compression algorithm.</p>
&lt;cmp:gunzip src=&quot;test.tar.gz&quot; xmlns:cmp="antlib:org.apache.ant.compress"/&gt;
<p>expands <i>test.tar.gz</i> to <i>test.tar</i></p>
&lt;cmp:bunzip2 src=&quot;test.tar.bz2&quot; xmlns:cmp="antlib:org.apache.ant.compress"/&gt;
<p>expands <i>test.tar.bz2</i> to <i>test.tar</i></p>
&lt;cmp:gunzip src=&quot;test.tar.gz&quot; dest=&quot;test2.tar&quot; xmlns:cmp="antlib:org.apache.ant.compress"/&gt;
<p>expands <i>test.tar.gz</i> to <i>test2.tar</i></p>
&lt;cmp:gunzip src=&quot;test.tar.gz&quot; dest=&quot;subdir&quot; xmlns:cmp="antlib:org.apache.ant.compress"/&gt;
<p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming
subdir is a directory).</p>
&lt;cmp:gunzip dest=&quot;.&quot; xmlns:cmp="antlib:org.apache.ant.compress"&gt;
&lt;url url=""/&gt;
<p>downloads <i></i> and expands it
to <i>archive.tar</i> in the project's basedir on the fly.</p>
<h3>Related tasks</h3>
&lt;cmp:gunzip src="some-archive.gz" dest="some-dest-dir" xmlns:cmp="antlib:org.apache.ant.compress"/&gt;
is identical to
&lt;copy todir="some-dest-dir"&gt;
&lt;cmp:gzipresource xmlns:cmp="antlib:org.apache.ant.compress"&gt;
&lt;file file="some-archive.gz"/&gt;
&lt;mapper type="glob" from="*.gz" to="*"/&gt;
<p>The same is also true for <code>&lt;bunzip2&gt;</code> and
<code>&lt;bzip2resource&gt;</code>. <code>&lt;copy&gt;</code> offers
additional features like <a
files</a> on the fly,
allowing a file to be mapped to multiple destinations, preserving the
last modified time or a configurable file system timestamp