You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2018/02/28 07:01:34 UTC
[19/47] ant git commit: Use HTML 5(-ish), fix links
http://git-wip-us.apache.org/repos/asf/ant/blob/66b52f99/manual/Tasks/zip.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/zip.html b/manual/Tasks/zip.html
index 46e9557..db3eb0f 100644
--- a/manual/Tasks/zip.html
+++ b/manual/Tasks/zip.html
@@ -27,517 +27,458 @@
<h2 id="zip">Zip</h2>
<h3>Description</h3>
<p>Creates a zipfile.</p>
-<p>The <i>basedir</i> attribute is the reference directory from where to zip.</p>
+<p>The <var>basedir</var> attribute is the reference directory from where to zip.</p>
<p>Note that file permissions will not be stored in the resulting zipfile.</p>
-<p>It is possible to refine the set of files that are being zipped. This can be
-done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
-attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
-have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
-the files you want to have excluded. This is also done with patterns. And
-finally with the <i>defaultexcludes</i> attribute, you can specify whether you
-want to use default exclusions or not. See the section on <a
-href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
+
+<p>It is possible to refine the set of files that are being zipped. This can be done with
+the <var>includes</var>, <var>includesfile</var>, <var>excludes</var>, <var>excludesfile</var>
+and <var>defaultexcludes</var> attributes. With the <var>includes</var> or <var>includesfile</var>
+attribute you specify the files you want to have included by using patterns. The <var>exclude</var>
+or <var>excludesfile</var> attribute is used to specify the files you want to have excluded. This is
+also done with patterns. And finally with the <var>defaultexcludes</var> attribute, you can specify
+whether you want to use default exclusions or not. See the section
+on <a href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
inclusion/exclusion of files works, and how to write patterns.</p>
-<p>This task forms an implicit <a href="../Types/fileset.html">FileSet</a> and
-supports most attributes of <code><fileset></code>
-(<code>dir</code> becomes <code>basedir</code>) as well as the nested
-<code><include></code>, <code><exclude></code> and
-<code><patternset></code> elements.</p>
-<p>Or, you may place within it nested file sets, or references to file sets.
-In this case <code>basedir</code> is optional; the implicit file set is <i>only used</i>
-if <code>basedir</code> is set. You may use any mixture of the implicit file set
-(with <code>basedir</code> set, and optional attributes like <code>includes</code>
-and optional subelements like <code><include></code>); explicit nested
-<code><fileset></code> elements so long as at least one fileset total is specified. The ZIP file will
-only reflect the relative paths of files <i>within</i> each fileset. The Zip task and its derivatives know a special form of a fileset named zipfileset that has additional attributes (described below).</p>
-<p>The Zip task also supports the merging of multiple zip files into the zip file.
-This is possible through either the <i>src</i> attribute of any nested filesets
-or by using the special nested fileset <i>zipgroupfileset</i>.</p>
-
-<p>The <code>update</code> parameter controls what happens if the ZIP
-file already exists. When set to <code>yes</code>, the ZIP file is
-updated with the files specified. (New files are added; old files are
-replaced with the new versions.) When set to <code>no</code> (the
-default) the ZIP file is overwritten if any of the files that would be
-added to the archive are newer than the entries inside the archive.
-Please note that ZIP files store file modification times with a
-granularity of two seconds. If a file is less than two seconds newer
-than the entry in the archive, Apache Ant will not consider it newer.</p>
-
-<p>The <code>whenempty</code> parameter controls what happens when no files match.
-If <code>skip</code> (the default), the ZIP is not created and a warning is issued.
-If <code>fail</code>, the ZIP is not created and the build is halted with an error.
-If <code>create</code>, an empty ZIP file (explicitly zero entries) is created,
-which should be recognized as such by compliant ZIP manipulation tools.</p>
-<p>This task will now use the platform's default character encoding
-for filenames - this is consistent with the command line ZIP tools,
-but causes problems if you try to open them from within Java and your
-filenames contain non US-ASCII characters. Use the encoding attribute
-and set it to UTF8 to create zip files that can safely be read by
-Java. For a more complete discussion,
+
+<p>This task forms an implicit <a href="../Types/fileset.html">FileSet</a> and supports most
+attributes of <code><fileset></code> (<var>dir</var> becomes <var>basedir</var>) as well as
+the nested <code><include></code>, <code><exclude></code>
+and <code><patternset></code> elements.</p>
+
+<p>Or, you may place within it nested file sets, or references to file sets. In this
+case <var>basedir</var> is optional; the implicit file set is <em>only used</em>
+if <var>basedir</var> is set. You may use any mixture of the implicit file set
+(with <var>basedir</var> set, and optional attributes like <var>includes</var> and optional
+subelements like <code><include></code>); explicit nested <code><fileset></code>
+elements so long as at least one fileset total is specified. The ZIP file will only reflect the
+relative paths of files <em>within</em> each fileset. The Zip task and its derivatives know a
+special form of a fileset named <code>zipfileset</code> that has additional attributes (described
+below).</p>
+
+<p>The Zip task also supports the merging of multiple zip files into the zip file. This is possible
+through either the <var>src</var> attribute of any nested filesets or by using the special nested
+fileset <code>zipgroupfileset</code>.</p>
+
+<p>The <var>update</var> parameter controls what happens if the ZIP file already exists. When set
+to <q>yes</q>, the ZIP file is updated with the files specified. (New files are added; old files are
+replaced with the new versions.) When set to <q>no</q> (the default) the ZIP file is overwritten if
+any of the files that would be added to the archive are newer than the entries inside the archive.
+Please note that ZIP files store file modification times with a granularity of 2 seconds. If a file
+is less than 2 seconds newer than the entry in the archive, Apache Ant will not consider it
+newer.</p>
+
+<p>The <var>whenempty</var> parameter controls what happens when no files match. If <q>skip</q>
+(the default), the ZIP is not created and a warning is issued. If <q>fail</q>, the ZIP is not
+created and the build is halted with an error. If <q>create</q>, an empty ZIP file (explicitly zero
+entries) is created, which should be recognized as such by compliant ZIP manipulation tools.</p>
+
+<p>This task will now use default JVM character encoding for filenames—this is consistent with
+the command line ZIP tools, but causes problems if you try to open them from within Java and your
+filenames contain non US-ASCII characters. Use the <var>encoding</var> attribute and set it
+to <q>UTF8</q> to create zip files that can safely be read by Java. For a more complete discussion,
see <a href="#encoding">below</a></p>
-<p><em>Since Ant 1.5.2</em>, <code><zip></code> can store Unix permissions
-inside the archive (see description of the filemode and dirmode
-attributes for <a href="../Types/zipfileset.html"><zipfileset></a>).
-Unfortunately there is no portable way to store these permissions.
-Ant uses the algorithm used by <a href="http://www.info-zip.org">Info-Zip's</a>
-implementation of the zip and unzip commands - these are the default
-versions of zip and unzip for many Unix and Unix-like systems.</p>
-
-<p><b>Please note that the zip format allows multiple files of the same
-fully-qualified name to exist within a single archive. This has been
-documented as causing various problems for unsuspecting users. If you wish
-to avoid this behavior you must set the <code>duplicate</code> attribute
-to a value other than its default, <code>"add"</code>.</b></p>
-
-<p><b>Please also note</b> that different ZIP tools handle timestamps
-differently when it comes to applying timezone offset calculations of
-files. Some ZIP libraries will store the timestamps as they've been
-read from the filesystem while others will modify the timestamps both
-when reading and writing the files to make all timestamps use the same
-timezone. A ZIP archive created by one library may extract files with
-"wrong timestamps" when extracted by another library.</p>
-
-<p>Ant's ZIP classes use the same algorithm as the InfoZIP tools and
-zlib (timestamps get adjusted), Windows' "compressed folders" function
-and WinZIP don't change the timestamps. This means that using the
-unzip task on files created by Windows' compressed folders function
-may create files with timestamps that are "wrong", the same is true if
-you use Windows' functions to extract an Ant generated ZIP
-archive.</p>
+<p><em>Since Ant 1.5.2</em>, <code><zip></code> can store Unix permissions inside the archive
+(see description of the <var>filemode</var> and <var>dirmode</var> attributes
+for <a href="../Types/zipfileset.html"><zipfileset></a>). Unfortunately there is no portable
+way to store these permissions. Ant uses the algorithm used
+by <a href="http://www.info-zip.org">Info-Zip's</a> implementation of the <code>zip</code>
+and <code>unzip</code> commands—these are the default versions of <code>zip</code>
+and <code>unzip</code> for many Unix(-like) systems.</p>
+
+<p><strong>Please note that the zip format allows multiple files of the same fully-qualified name to
+exist within a single archive. This has been documented as causing various problems for
+unsuspecting users. If you wish to avoid this behavior you must set the <var>duplicate</var>
+attribute to a value other than its default, <q>add</q>.</strong></p>
+
+<p><strong>Please also note</strong> that different ZIP tools handle timestamps differently when it
+comes to applying timezone offset calculations of files. Some ZIP libraries will store the
+timestamps as they've been read from the filesystem while others will modify the timestamps both
+when reading and writing the files to make all timestamps use the same timezone. A ZIP archive
+created by one library may extract files with "wrong timestamps" when extracted by another
+library.</p>
+
+<p>Ant's ZIP classes use the same algorithm as the InfoZIP tools and zlib (timestamps get adjusted),
+Windows' "compressed folders" function and WinZIP don't change the timestamps. This means that
+using the <code>unzip</code> task on files created by Windows' compressed folders function may
+create files with timestamps that are "wrong", the same is true if you use Windows' functions to
+extract an Ant generated ZIP archive.</p>
<h3>Parameters</h3>
-<table>
+<table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td valign="top" align="center"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">destfile</td>
- <td valign="top">the zip-file to create.</td>
- <td align="center" valign="top" rowspan="2">Exactly one of the two</td>
+ <td>destfile</td>
+ <td>the zip file to create.</td>
+ <td rowspan="2">Exactly one of the two</td>
</tr>
<tr>
- <td valign="top">zipfile</td>
- <td valign="top">the <i>deprecated</i> old name of destfile.</td>
+ <td>zipfile</td>
+ <td class="left"><em><u>deprecated</u></em> old name of <var>destfile</var>.</td>
</tr>
<tr>
- <td valign="top">basedir</td>
- <td valign="top">the directory from which to zip the files.</td>
- <td align="center" valign="top">No</td>
+ <td>basedir</td>
+ <td>the directory from which to zip the files.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">compress</td>
- <td valign="top">Not only store data but also compress them,
- defaults to true. Unless you set the <em>keepcompression</em>
- attribute to false, this will apply to the entire archive, not
- only the files you've added while updating.</td>
- <td align="center" valign="top">No</td>
+ <td>compress</td>
+ <td>Not only store data but also compress them. Unless you set the <var>keepcompression</var>
+ attribute to <q>false</q>, this will apply to the entire archive, not only the files you've
+ added while updating.</td>
+ <td>No; defaults to <q>true</q></td>
</tr>
<tr>
- <td valign="top">keepcompression</td>
- <td valign="top">For entries coming from existing archives (like
- nested <em>zipfileset</em>s or while updating the archive), keep
- the compression as it has been originally instead of using the
- <em>compress</em> attribute. Defaults to false. <em>Since Ant
- 1.6</em></td>
- <td align="center" valign="top">No</td>
+ <td>keepcompression</td>
+ <td>For entries coming from existing archives (like nested <code>zipfileset</code>s or while
+ updating the archive), keep the compression as it has been originally instead of using
+ the <var>compress</var> attribute. <em>Since Ant 1.6</em></td>
+ <td>No; defaults to <q>false</q></td>
</tr>
<tr>
- <td valign="top">encoding</td>
- <td valign="top">The character encoding to use for filenames
- inside the zip file. For a list of possible values see the <a
- href="http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a>.<br/>
- Defaults to the platform's default character encoding.
- <br/>See also the <a href="#encoding">discussion below</a></td>
- <td align="center" valign="top">No</td>
+ <td>encoding</td>
+ <td>The character encoding to use for filenames inside the zip file. For a list of possible
+ values see
+ the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html">Supported
+ Encodings</a>.</td>
+ <td>No; defaults to default JVM character encoding</td>
</tr>
<tr>
- <td valign="top">filesonly</td>
- <td valign="top">Store only file entries, defaults to false</td>
- <td align="center" valign="top">No</td>
+ <td>filesonly</td>
+ <td>Store only file entries.</td>
+ <td>No; defaults to <q>false</q></td>
</tr>
<tr>
- <td valign="top">includes</td>
- <td valign="top">comma- or space-separated list of patterns of files that must be
- included. All files are included when omitted.</td>
- <td valign="top" align="center">No</td>
+ <td>includes</td>
+ <td>comma- or space-separated list of patterns of files that must be included.</td>
+ <td>No; defaults to all (<q>**</q>)</td>
</tr>
<tr>
- <td valign="top">includesfile</td>
- <td valign="top">the name of a file. Each line of this file is
- taken to be an include pattern</td>
- <td valign="top" align="center">No</td>
+ <td>includesfile</td>
+ <td>name of a file. Each line of this file is taken to be an include pattern.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">excludes</td>
- <td valign="top">comma- or space-separated list of patterns of files that must be
- excluded. No files (except default excludes) are excluded when omitted.</td>
- <td valign="top" align="center">No</td>
+ <td>excludes</td>
+ <td>comma- or space-separated list of patterns of files that must be excluded.</td>
+ <td>No; defaults to default excludes or none if <var>defaultexcludes</var> is <q>no</q></td>
</tr>
<tr>
- <td valign="top">excludesfile</td>
- <td valign="top">the name of a file. Each line of this file is
- taken to be an exclude pattern</td>
- <td valign="top" align="center">No</td>
+ <td>excludesfile</td>
+ <td>name of a file. Each line of this file is taken to be an exclude pattern.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">defaultexcludes</td>
- <td valign="top">indicates whether default excludes should be used or not
- ("yes"/"no"). Default excludes are used when omitted.</td>
- <td valign="top" align="center">No</td>
+ <td>defaultexcludes</td>
+ <td>indicates whether default excludes should be used or not (<q>yes|no</q>).</td>
+ <td>No; defaults to <q>yes</q></td>
</tr>
<tr>
- <td valign="top">update</td>
- <td valign="top">indicates whether to update or overwrite
- the destination file if it already exists. Default is "false".</td>
- <td valign="top" align="center">No</td>
+ <td>update</td>
+ <td>indicates whether to update or overwrite the destination file if it already exists.</td>
+ <td>No; default is <q>false</q></td>
</tr>
<tr>
- <td valign="top">whenempty</td>
- <td valign="top">behavior when no files match. Valid values are "fail", "skip", and "create". Default is "skip".</td>
- <td valign="top" align="center">No</td>
+ <td>whenempty</td>
+ <td>behavior when no files match. Valid values are <q>fail</q>, <q>skip</q>,
+ and <q>create</q>.</td>
+ <td>No; default is <q>skip</q></td>
</tr>
<tr>
- <td valign="top">duplicate</td>
- <td valign="top">behavior when a duplicate file is found. Valid values are "add", "preserve", and "fail". The default value is "add".</td>
- <td valign="top" align="center">No</td>
+ <td>duplicate</td>
+ <td>behavior when a duplicate file is found. Valid values are <q>add</q>, <q>preserve</q>,
+ and <q>fail</q>.</td>
+ <td>No; default is <q>add</q></td>
</tr>
<tr>
- <td valign="top">roundup</td>
- <td valign="top">Whether the file modification times will be
- rounded up to the next even number of seconds.<br>
- Zip archives store file modification times with a granularity of
- two seconds, so the times will either be rounded up or down. If
- you round down, the archive will always seem out-of-date when you
- rerun the task, so the default is to round up. Rounding up may
- lead to a different type of problems like JSPs inside a web
- archive that seem to be slightly more recent than precompiled
- pages, rendering precompilation useless.<br>
- Defaults to true. <em>Since Ant 1.6.2</em></td>
- <td align="center" valign="top">No</td>
+ <td>roundup</td>
+ <td>Whether the file modification times will be rounded up to the next even number of
+ seconds.<br/>Zip archives store file modification times with a granularity of 2 seconds, so
+ the times will either be rounded up or down. If you round down, the archive will always seem
+ out-of-date when you rerun the task, so the default is to round up. Rounding up may lead to a
+ different type of problems like JSPs inside a web archive that seem to be slightly more recent
+ than precompiled pages, rendering precompilation useless. <em>Since Ant 1.6.2</em></td>
+ <td>No; defaults to <q>true</q></td>
</tr>
<tr>
- <td valign="top">comment</td>
- <td valign="top">Comment to store in the archive. <em>Since Ant 1.6.3</em></td>
- <td valign="top" align="center">No</td>
+ <td>comment</td>
+ <td>Comment to store in the archive. <em>Since Ant 1.6.3</em></td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">level</td>
- <td valign="top">Non-default level at which file compression should be
- performed. Valid values range from 0 (no compression/fastest) to 9
- (maximum compression/slowest). <em>Since Ant 1.7</em></td>
- <td valign="top" align="center">No</td>
+ <td>level</td>
+ <td>Non-default level at which file compression should be performed. Valid values range
+ from <q>0</q> (no compression/fastest) to <q>9</q> (maximum compression/slowest). <em>Since
+ Ant 1.7</em></td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">preserve0permissions</td>
- <td valign="top">when updating an archive or adding entries from a
- different archive Ant will assume that a Unix permissions value of
- 0 (nobody is allowed to do anything to the file/directory) means
- that the permissions haven't been stored at all rather than real
- permissions and will instead apply its own default values.<br/>
- Set this attribute to true if you really want to preserve the
- original permission field. <em>Since Ant 1.8.0</em>
+ <td>preserve0permissions</td>
+ <td>when updating an archive or adding entries from a different archive Ant will assume that a
+ Unix permissions value of 0 (nobody is allowed to do anything to the file/directory) means
+ that the permissions haven't been stored at all rather than real permissions and will instead
+ apply its own default values.<br/> Set this attribute to <q>true</q> if you really want to
+ preserve the original permission field. <em>Since Ant 1.8.0</em>
</td>
- <td valign="top" align="center">No, default is false</td>
+ <td>No; default is <q>false</q></td>
</tr>
<tr>
- <td valign="top">useLanguageEncodingFlag</td>
- <td valign="top">Whether to set the language encoding flag if the
- encoding is UTF-8. This setting doesn't have any effect if the
- encoding is not UTF-8.
- <em>Since Ant 1.8.0</em>.<br/>
- See also the <a href="#encoding">discussion below</a></td>
- <td align="center" valign="top">No, default is true</td>
+ <td>useLanguageEncodingFlag</td>
+ <td>Whether to set the language encoding flag if the encoding is UTF-8. This setting doesn't
+ have any effect if the encoding is not UTF-8. <em>Since Ant 1.8.0</em>.<br/>See also
+ the <a href="#encoding">discussion below</a></td>
+ <td>No; default is <q>true</q></td>
</tr>
<tr>
- <td valign="top">createUnicodeExtraFields</td>
- <td valign="top">Whether to create unicode extra fields to store
- the file names a second time inside the entry's metadata.
- <br>Possible values are "never", "always" and "not-encodeable"
- which will only add Unicode extra fields if the file name cannot
- be encoded using the specified encoding.
- <em>Since Ant 1.8.0</em>.<br/>
- See also the <a href="#encoding">discussion below</a></td>
- <td align="center" valign="top">No, default is "never"</td>
+ <td>createUnicodeExtraFields</td>
+ <td>Whether to create Unicode extra fields to store the file names a second time inside the
+ entry's metadata.<br/>Possible values are <q>never</q>, <q>always</q>
+ and <q>not-encodeable</q> which will only add Unicode extra fields if the file name cannot be
+ encoded using the specified encoding. <em>Since Ant 1.8.0</em>.<br/>See also
+ the <a href="#encoding">discussion below</a></td>
+ <td>No; default is <q>never</q></td>
</tr>
<tr>
- <td valign="top">fallbacktoUTF8</td>
- <td valign="top">Whether to use UTF-8 and the language encoding
- flag instead of the specified encoding if a file name cannot be
- encoded using the specified encoding.
- <em>Since Ant 1.8.0</em>.<br/>
- See also the <a href="#encoding">discussion below</a></td>
- <td align="center" valign="top">No, default is false</td>
+ <td>fallbacktoUTF8</td>
+ <td>Whether to use UTF-8 and the language encoding flag instead of the specified encoding if a
+ file name cannot be encoded using the specified encoding. <em>Since Ant 1.8.0</em>.<br/>See
+ also the <a href="#encoding">discussion below</a></td>
+ <td>No; default is <q>false</q></td>
</tr>
<tr>
- <td valign="top">zip64Mode</td>
- <td valign="top">When to use Zip64 extensions for entries. The
- possible values are "never", "always" and "as-needed".
- <em>Since Ant 1.9.1</em>.<br/>
- See also the <a href="#zip64">discussion below</a></td>
- <td align="center" valign="top">No, default is "as-needed"</td>
+ <td>zip64Mode</td>
+ <td>When to use Zip64 extensions for entries. The possible values
+ are <q>never</q>, <q>always</q> and <q>as-needed</q>. <em>Since Ant 1.9.1</em>.<br/>See also
+ the <a href="#zip64">discussion below</a></td>
+ <td>No; default is <q>as-needed</q></td>
</tr>
</table>
<h3 id="encoding">Encoding of File Names</h3>
-<p>Traditionally the ZIP archive format uses CodePage 437 as encoding
- for file name, which is not sufficient for many international
- character sets.</p>
-
-<p>Over time different archivers have chosen different ways to work
- around the limitation - the <code>java.util.zip</code> packages
- simply uses UTF-8 as its encoding for example.</p>
-
-<p>Ant has been offering the encoding attribute of the zip and unzip
- task as a way to explicitly specify the encoding to use (or expect)
- <em>since Ant 1.4</em>. It defaults to the platform's default encoding for
- zip and UTF-8 for jar and other jar-like tasks (war, ear, ...) as
- well as the unzip family of tasks.</p>
-
-<p>More recent versions of the ZIP specification introduce something
- called the "language encoding flag" which can be used to
- signal that a file name has been encoded using UTF-8. <em>Since
- Ant 1.8.0</em>, all zip, jar and similar archives written by Ant will set
- this flag, if the encoding has been set to UTF-8. Our
- interoperability tests with existing archivers didn't show any ill
- effects (in fact, most archivers ignore the flag to date), but you
- can turn off the "language encoding flag" by setting the attribute
- <code>useLanguageEncodingFlag</code> to <code>false</code> on the
- zip-task if you should encounter problems.</p>
-
-<p>The unzip task (and similar tasks) will recognize the language
- encoding flag and ignore the encoding set on the task if it has been
- found.</p>
-
-<p>The InfoZIP developers have introduced new ZIP extra fields that
- can be used to add an additional UTF-8 encoded file name to the
- entry's metadata. Most archivers ignore these extra fields.
- <em>Since Ant 1.8.0</em>, the zip family of tasks support an
- option <code>createUnicodeExtraFields</code>, which
- makes Ant write these extra fields either for all entries ("always")
- or only those whose name cannot be encoded using the specified
- encoding (not-encodeable), it defaults to "never" since the extra
- fields create bigger archives.</p>
-
-<p>The fallbackToUTF8 attribute of zip can be used to create archives
- that use the specified encoding in the majority of cases but UTF-8 and
- the language encoding flag for filenames that cannot be encoded
- using the specified encoding.</p>
-
-<p>The unzip-task will recognize the unicode extra fields by default
- and read the file name information from them, unless you set the
- optional attribute <code>scanForUnicodeExtraFields</code> to
- false.</p>
+<p>Traditionally the ZIP archive format uses CodePage 437 as encoding for file name, which is not
+sufficient for many international character sets.</p>
+
+<p>Over time different archivers have chosen different ways to work around the
+limitation—the <code>java.util.zip</code> packages simply uses UTF-8 as its encoding for
+example.</p>
+
+<p>Ant has been offering the <q>encoding</q> attribute of the <code>zip</code>
+and <code>unzip</code> task as a way to explicitly specify the encoding to use (or expect) <em>since
+Ant 1.4</em>. It defaults to default JVM character encoding for <code>zip</code> and UTF-8
+for <code>jar</code> and other jar-like tasks (<code>war</code>, <code>ear</code>, ...) as well as
+the <code>unzip</code> family of tasks.</p>
+
+<p>More recent versions of the ZIP specification introduce something called the <q>language encoding
+flag</q> which can be used to signal that a file name has been encoded using UTF-8. <em>Since Ant
+1.8.0</em>, all zip, jar and similar archives written by Ant will set this flag, if the encoding has
+been set to UTF-8. Our interoperability tests with existing archivers didn't show any ill effects
+(in fact, most archivers ignore the flag to date), but you can turn off the <q>language encoding
+flag</q> by setting the attribute <var>useLanguageEncodingFlag</var> to <q>false</q> on
+the <code>zip</code> task if you should encounter problems.</p>
+
+<p>The <code>unzip</code> task (and similar tasks) will recognize the language encoding flag and
+ignore the encoding set on the task if it has been found.</p>
+
+<p>The InfoZIP developers have introduced new ZIP extra fields that can be used to add an additional
+UTF-8 encoded file name to the entry's metadata. Most archivers ignore these extra
+fields. <em>Since Ant 1.8.0</em>, the <code>zip</code> family of tasks support an
+option <var>createUnicodeExtraFields</var>, which makes Ant write these extra fields either for all
+entries (<q>always</q>) or only those whose name cannot be encoded using the specified encoding
+(<q>not-encodeable</q>), it defaults to <q>never</q> since the extra fields create bigger
+archives.</p>
+
+<p>The <var>fallbackToUTF8</var> attribute of <code>zip</code> can be used to create archives that
+use the specified encoding in the majority of cases but UTF-8 and the language encoding flag for
+filenames that cannot be encoded using the specified encoding.</p>
+
+<p>The <code>unzip</code> task will recognize the Unicode extra fields by default and read the file
+name information from them, unless you set the optional
+attribute <var>scanForUnicodeExtraFields</var> to <q>false</q>.</p>
<h4>Recommendations for Interoperability</h4>
-<p>The optimal setting of flags depends on the archivers you expect as
- consumers/producers of the ZIP archives. Below are some test
- results which may be superseded with later versions of each
- tool.</p>
+<p>The optimal setting of flags depends on the archivers you expect as consumers/producers of the
+ZIP archives. Below are some test results which may be superseded with later versions of each
+tool.</p>
<ul>
- <li>The java.util.zip package used by the jar executable or to read
- jars from your CLASSPATH reads and writes UTF-8 names, it doesn't
- set or recognize any flags or unicode extra fields.</li>
-
- <li>Since Java 7, <code>java.util.zip</code> writes UTF-8 by
- default and uses the language encoding flag. It is possible to
- specify a different encoding when reading/writing ZIPs via new
- constructors. The package now recognizes the language encoding
- flag when reading and ignores the Unicode extra fields.</li>
-
- <li>7Zip writes CodePage 437 by default but uses UTF-8 and the
- language encoding flag when writing entries that cannot be encoded
- as CodePage 437 (similar to the zip task with fallbacktoUTF8 set
- to true). It recognizes the language encoding flag when reading
- and ignores the unicode extra fields.</li>
-
- <li>WinZIP writes CodePage 437 and uses unicode extra fields by
- default. It recognizes the unicode extra field and the language
- encoding flag when reading.</li>
-
- <li>Windows' "compressed folder" feature doesn't recognize any flag
- or extra field and creates archives using the platforms default
- encoding - and expects archives to be in that encoding when reading
- them.</li>
-
- <li>InfoZIP based tools can recognize and write both, it is a
- compile time option and depends on the platform so your mileage
- may vary.</li>
-
- <li>PKWARE zip tools recognize both and prefer the language encoding
- flag. They create archives using CodePage 437 if possible and UTF-8
- plus the language encoding flag for file names that cannot be
- encoded as CodePage 437.</li>
+ <li>The <code>java.util.zip</code> package used by the <code>jar</code> executable or to read jars
+ from your <code>CLASSPATH</code> reads and writes UTF-8 names, it doesn't set or recognize any
+ flags or unicode extra fields.</li>
+ <li>Since Java 7, <code>java.util.zip</code> writes UTF-8 by default and uses the language
+ encoding flag. It is possible to specify a different encoding when reading/writing ZIPs via new
+ constructors. The package now recognizes the language encoding flag when reading and ignores
+ the Unicode extra fields.</li>
+ <li>7Zip writes CodePage 437 by default but uses UTF-8 and the language encoding flag when writing
+ entries that cannot be encoded as CodePage 437 (similar to the <code>zip</code> task
+ with <var>fallbacktoUTF8</var> set to <q>true</q>). It recognizes the language encoding flag
+ when reading and ignores the Unicode extra fields.</li>
+ <li>WinZIP writes CodePage 437 and uses Unicode extra fields by default. It recognizes the
+ Unicode extra field and the language encoding flag when reading.</li>
+ <li>Windows' "compressed folder" feature doesn't recognize any flag or extra field and creates
+ archives using the default platform encoding—and expects archives to be in that encoding
+ when reading them.</li>
+ <li>InfoZIP based tools can recognize and write both, it is a compile time option and depends on
+ the platform so your mileage may vary.</li>
+ <li>PKWARE zip tools recognize both and prefer the language encoding flag. They create archives
+ using CodePage 437 if possible and UTF-8 plus the language encoding flag for file names that
+ cannot be encoded as CodePage 437.</li>
</ul>
<p>So, what to do?</p>
-<p>If you are creating jars, then java.util.zip is your main
- consumer. We recommend you set the encoding to UTF-8 and keep the
- language encoding flag enabled. The flag won't help or hurt
- java.util.zip prior to Java 7 but archivers that support it will show
- the correct file names.</p>
-
-<p>For maximum interop it is probably best to set the encoding to
- UTF-8, enable the language encoding flag and create unicode extra
- fields when writing ZIPs. Such archives should be extracted
- correctly by java.util.zip, 7Zip, WinZIP, PKWARE tools and most
- likely InfoZIP tools. They will be unusable with Windows'
- "compressed folders" feature and bigger than archives without the
- unicode extra fields, though.</p>
-
-<p>If Windows' "compressed folders" is your primary consumer, then
- your best option is to explicitly set the encoding to the target
- platform. You may want to enable creation of unicode extra fields
- so the tools that support them will extract the file names
- correctly.</p>
+<p>If you are creating jars, then <code>java.util.zip</code> is your main consumer. We recommend
+you set the encoding to UTF-8 and keep the language encoding flag enabled. The flag won't help or
+hurt <code>java.util.zip</code> prior to Java 7 but archivers that support it will show the correct
+file names.</p>
+
+<p>For maximum interoparability it is probably best to set the encoding to UTF-8, enable the
+language encoding flag and create Unicode extra fields when writing ZIPs. Such archives should be
+extracted correctly by <code>java.util.zip</code>, 7Zip, WinZIP, PKWARE tools and most likely
+InfoZIP tools. They will be unusable with Windows' "compressed folders" feature and bigger than
+archives without the Unicode extra fields, though.</p>
+
+<p>If Windows' "compressed folders" is your primary consumer, then your best option is to explicitly
+set the encoding to the target platform. You may want to enable creation of Unicode extra fields so
+the tools that support them will extract the file names correctly.</p>
<h3 id="zip64">Zip64 extensions</h3>
-<p>Zip64 extensions provide a way to create archives bigger than 4GB
- or holding more than 65535 entries - or add individual entries
- bigger than 4GB using the ZIP extension field mechanism. These
- extensions are supported by most modern ZIP implementations.</p>
+<p>Zip64 extensions provide a way to create archives bigger than 4 GB or holding more than 65535
+entries—or add individual entries bigger than 4 GB using the ZIP extension field mechanism.
+These extensions are supported by most modern ZIP implementations.</p>
-<p>When Ant writes compressed entries into the archive it creates it
- doesn't know the compressed size of an entry before it has been
- written. Unfortunately the decision whether a Zip64 extra field
- will be written has to be made before writing the entry's
- content.</p>
+<p>When Ant writes compressed entries into the archive it creates it doesn't know the compressed
+size of an entry before it has been written. Unfortunately the decision whether a Zip64 extra field
+will be written has to be made before writing the entry's content.</p>
-<p>Ant 1.9.0 introduced support for Zip64 extensions but didn't
- provide any control over their usage. <em>Since Ant 1.9.1</em>, a
- new <em>zip64mode</em> attribute was added to the <code>zip</code>
- family of tasks. It supports three values:
+<p>Ant 1.9.0 introduced support for Zip64 extensions but didn't provide any control over their
+usage. <em>Since Ant 1.9.1</em>, a new <var>zip64mode</var> attribute was added to
+the <code>zip</code> family of tasks. It supports three values:
<ul>
- <li><em>never</em> means no Zip64 extra fields will ever be
- written. This is the behavior of Ant prior to 1.9.0 and the
- default behavior of <code>jar</code>, <code>ear</code>
+ <li><q>never</q> means no Zip64 extra fields will ever be written. This is the behavior of Ant
+ prior to 1.9.0 and the default behavior of <code>jar</code>, <code>ear</code>
and <code>war</code> <em>since Ant 1.9.1</em>.</li>
- <li><em>always</em> means Zip64 extra fields are written for all
- entries.</li>
- <li><em>as-needed</em> means Zip64 extra fields are written for all
- compressed entries to the "local file header" (by default these
- are all files but not the directories) but only written to the
- central directory if the entry really required Zip64 features.
- This is the default behavior of Ant 1.9.0 and remains the default
- behavior of the <code>zip</code> task.</li>
+ <li><q>always</q> means Zip64 extra fields are written for all entries.</li>
+ <li><q>as-needed</q> means Zip64 extra fields are written for all compressed entries to the "local
+ file header" (by default these are all files but not the directories) but only written to the
+ central directory if the entry really required Zip64 features. This is the default behavior of
+ Ant 1.9.0 and remains the default behavior of the <code>zip</code> task.</li>
</ul>
-<p><em>as-needed</em> provides a good compromise if you don't know
- whether you archive will exceed the limits of traditional zip files
- but don't want to waste too much space (the Zip64 extensions take up
- extra space). Unfortunately some ZIP implementations don't
- understand Zip64 extra fields or fail to parse archives with extra
- fields in local file headers that are not present in the central
- directory, one such implementation is the java.util.zip package of
- Java 5, that's why the <code>jar</code> tasks default
- to <em>never</em>. Archives created with <em>as-needed</em> can be
- read without problems with Java 6 and later.</p>
+<p><q>as-needed</q> provides a good compromise if you don't know whether you archive will exceed the
+limits of traditional zip files but don't want to waste too much space (the Zip64 extensions take up
+extra space). Unfortunately some ZIP implementations don't understand Zip64 extra fields or fail to
+parse archives with extra fields in local file headers that are not present in the central
+directory, one such implementation is the <code>java.util.zip</code> package of Java 5, that's why
+the <code>jar</code> tasks default to <q>never</q>. Archives created with <q>as-needed</q> can be
+read without problems with Java 6 and later.</p>
<h3>Parameters specified as nested elements</h3>
<h4>any resource collection</h4>
-<p><a href="../Types/resources.html#collection">Resource
-Collection</a>s are used to select groups of files to archive.</p>
-<p>Prior to Ant 1.7 only <code><fileset></code> and
-<code><zipfileset></code> have been supported as nested elements.</p>
+<p><a href="../Types/resources.html#collection">Resource Collection</a>s are used to select groups
+of files to archive.</p>
+<p>Prior to Ant 1.7 only <code><fileset></code> and <code><zipfileset></code> have been
+supported as nested elements.</p>
<h4 id="zipgroupfileset">zipgroupfileset</h4>
-<p>A <code><zipgroupfileset></code> allows for multiple zip files to be
-merged into the archive. Each file found in this fileset is added to the archive
-the same way that <i>zipfileset src</i> files are added.</p>
+<p>A <code><zipgroupfileset></code> allows for multiple zip files to be merged into the
+archive. Each file found in this fileset is added to the archive the same way
+that <code>zipfileset</code> <var>src</var> files are added.</p>
-<p><code><zipgroupfileset></code> is
- a <a href="../Types/fileset.html">fileset</a> and supports all
- of its attributes and nested elements.</p>
+<p><code><zipgroupfileset></code> is a <a href="../Types/fileset.html">fileset</a> and
+supports all of its attributes and nested elements.</p>
<h3>Examples</h3>
-<pre> <zip destfile="${dist}/manual.zip"
- basedir="htdocs/manual"/></pre>
-<p>zips all files in the <code>htdocs/manual</code> directory into a file called <code>manual.zip</code>
-in the <code>${dist}</code> directory.</p>
-<pre> <zip destfile="${dist}/manual.zip"
- basedir="htdocs/manual"
- update="true"/></pre>
-<p>zips all files in the <code>htdocs/manual</code> directory into a file called <code>manual.zip</code>
-in the <code>${dist}</code> directory. If <code>manual.zip</code>
-doesn't exist, it is created; otherwise it is updated with the
-new/changed files.</p>
-<pre> <zip destfile="${dist}/manual.zip"
- basedir="htdocs/manual"
- excludes="mydocs/**, **/todo.html"/></pre>
-<p>zips all files in the <code>htdocs/manual</code> directory. Files in the directory <code>mydocs</code>,
-or files with the name <code>todo.html</code> are excluded.</p>
-<pre> <zip destfile="${dist}/manual.zip"
- basedir="htdocs/manual"
- includes="api/**/*.html"
- excludes="**/todo.html"/></pre>
-<p>zips all files in the <code>htdocs/manual</code> directory. Only html files under the directory <code>api</code>
-are zipped, and files with the name <code>todo.html</code> are excluded.</p>
-<pre> <zip destfile="${dist}/manual.zip">
- <fileset dir="htdocs/manual"/>
- <fileset dir="." includes="ChangeLog.txt"/>
- </zip></pre>
-<p>zips all files in the <code>htdocs/manual</code> directory, and also adds the file <code>ChangeLog.txt</code> in the
-current directory. <code>ChangeLog.txt</code> will be added to the top of the ZIP file, just as if
-it had been located at <code>htdocs/manual/ChangeLog.txt</code>.</p>
-<pre> <zip destfile="${dist}/manual.zip">
- <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
- <zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
- <zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/>
- </zip></pre>
-<p>zips all files in the <code>htdocs/manual</code> directory into the <code>docs/user-guide</code> directory
-in the archive, adds the file <code>ChangeLog27.txt</code> in the
-current directory as <code>docs/ChangeLog.txt</code>, and includes all the html files in <code>examples.zip</code>
-under <code>docs/examples</code>. The archive might end up containing the files:</p>
-<pre> docs/user-guide/html/index.html
+<pre>
+<zip destfile="${dist}/manual.zip"
+ basedir="htdocs/manual"/></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory into a file
+called <samp>manual.zip</samp> in the <samp>${dist}</samp> directory.</p>
+<pre>
+<zip destfile="${dist}/manual.zip"
+ basedir="htdocs/manual"
+ update="true"/></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory into a file
+called <samp>manual.zip</samp> in the <samp>${dist}</samp> directory. If <samp>manual.zip</samp>
+doesn't exist, it is created; otherwise it is updated with the new/changed files.</p>
+<pre>
+<zip destfile="${dist}/manual.zip"
+ basedir="htdocs/manual"
+ excludes="mydocs/**, **/todo.html"/></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory. Files in the
+directory <samp>mydocs</samp>, or files with the name <samp>todo.html</samp> are excluded.</p>
+<pre>
+<zip destfile="${dist}/manual.zip"
+ basedir="htdocs/manual"
+ includes="api/**/*.html"
+ excludes="**/todo.html"/></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory. Only <samp>html</samp> files under
+the directory <samp>api</samp> are zipped, and files with the name <samp>todo.html</samp> are
+excluded.</p>
+<pre>
+<zip destfile="${dist}/manual.zip">
+ <fileset dir="htdocs/manual"/>
+ <fileset dir="." includes="ChangeLog.txt"/>
+</zip></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory, and also adds the
+file <samp>ChangeLog.txt</samp> in the current directory. <samp>ChangeLog.txt</samp> will be added
+to the top of the ZIP file, just as if it had been located
+at <samp>htdocs/manual/ChangeLog.txt</samp>.</p>
+<pre>
+<zip destfile="${dist}/manual.zip">
+ <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
+ <zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
+ <zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/>
+</zip></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory into the <samp>docs/user-guide</samp>
+directory in the archive, adds the file <samp>ChangeLog27.txt</samp> in the current directory
+as <samp>docs/ChangeLog.txt</samp>, and includes all the <samp>html</samp> files
+in <samp>examples.zip</samp> under <samp>docs/examples</samp>. The archive might end up containing
+the files:</p>
+<pre>
+ docs/user-guide/html/index.html
docs/ChangeLog.txt
- docs/examples/index.html
-</pre>
-<p>
-The code
+ docs/examples/index.html</pre>
+<p>The code</p>
<pre>
- <zip destfile="${dist}/manual.zip">
- <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
- <zipgroupfileset dir="." includes="examples*.zip"/>
- </zip>
-</pre>
-<p>
-<p>zips all files in the <code>htdocs/manual</code> directory into the <code>docs/user-guide</code> directory in the archive and includes all the files in any file that matches <code>examples*.zip</code>, such as all files within <code>examples1.zip</code> or <code>examples_for_brian.zip</code>.
-The same can be achieved with
+<zip destfile="${dist}/manual.zip">
+ <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
+ <zipgroupfileset dir="." includes="examples*.zip"/>
+</zip></pre>
+<p>zips all files in the <samp>htdocs/manual</samp> directory into the <samp>docs/user-guide</samp>
+directory in the archive and includes all the files in any file that
+matches <samp>examples*.zip</samp>, such as all files within <samp>examples1.zip</samp>
+or <samp>examples_for_brian.zip</samp>. The same can be achieved with</p>
<pre>
- <zip destfile="${dist}/manual.zip">
- <mappedresources>
- <fileset dir="htdocs/manual"/>
- <globmapper from="*" to="docs/user-guide/*"/>
- </mappedresources>
- <archives>
- <zips>
- <fileset dir="." includes="examples*.zip"/>
- </zips>
- </archives>
- </zip>
-</pre>
-
-The next example
+<zip destfile="${dist}/manual.zip">
+ <mappedresources>
+ <fileset dir="htdocs/manual"/>
+ <globmapper from="*" to="docs/user-guide/*"/>
+ </mappedresources>
+ <archives>
+ <zips>
+ <fileset dir="." includes="examples*.zip"/>
+ </zips>
+ </archives>
+</zip></pre>
+
+<p>The next example</p>
<pre>
<zip destfile="release.zip">
<tarfileset src="release.tar"/>
-</zip>
-</pre>
+</zip></pre>
-<p>re-packages a TAR archive as a ZIP archive. If Unix file
-permissions have been stored as part of the TAR file, they will be
-retained in the resulting ZIP archive.</p>
+<p>re-packages a TAR archive as a ZIP archive. If Unix file permissions have been stored as part of
+the TAR file, they will be retained in the resulting ZIP archive.</p>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/ant/blob/66b52f99/manual/Types/antlib.html
----------------------------------------------------------------------
diff --git a/manual/Types/antlib.html b/manual/Types/antlib.html
index bace8de..bafc2f9 100644
--- a/manual/Types/antlib.html
+++ b/manual/Types/antlib.html
@@ -27,209 +27,191 @@
<h3>Description</h3>
<p>
- An antlib file is an xml file with a root element of "antlib".
- Antlib's elements are Apache Ant definition tasks - like
- <a href="../Tasks/taskdef.html">Taskdef</a>
- or any Ant task that extends
- <code>org.apache.tools.ant.taskdefs.AntlibDefinition</code>.
+ An antlib file is an xml file with a root element of <code>antlib</code>. Antlib's
+ elements are Apache Ant definition
+ tasks—like <a href="../Tasks/taskdef.html">Taskdef</a> or any Ant task that
+ extends <code>org.apache.tools.ant.taskdefs.AntlibDefinition</code>.
</p>
<p>
- The current set of declarations bundled with Ant that do this are:
+ The current set of declarations bundled with Ant that do this are:
</p>
- <ol>
- <li><a href="../Tasks/typedef.html">Typedef</a>
- </li>
- <li><a href="../Tasks/taskdef.html">Taskdef</a>
- </li>
- <li><a href="../Tasks/macrodef.html">Macrodef</a>
- </li>
- <li><a href="../Tasks/presetdef.html">Presetdef</a>
- </li>
- <li><a href="../Tasks/scriptdef.html">Scriptdef</a>
- </li>
- </ol>
+ <ol>
+ <li><a href="../Tasks/typedef.html">Typedef</a></li>
+ <li><a href="../Tasks/taskdef.html">Taskdef</a></li>
+ <li><a href="../Tasks/macrodef.html">Macrodef</a></li>
+ <li><a href="../Tasks/presetdef.html">Presetdef</a></li>
+ <li><a href="../Tasks/scriptdef.html">Scriptdef</a></li>
+ </ol>
<p>
- A group of tasks and types may be defined together in an antlib
- file. For example the file <i>sample.xml</i> contains the following:
+ A group of tasks and types may be defined together in an antlib file. For example the
+ file <samp>sample.xml</samp> contains the following:
</p>
<pre>
<?xml version="1.0"?>
<antlib>
- <typedef name="if" classname="org.acme.ant.If"/>
- <typedef name="scriptpathmapper"
- classname="org.acme.ant.ScriptPathMapper"
- onerror="ignore"/>
- <macrodef name="print">
- <attribute name="file"/>
- <sequential>
- <concat taskname="print">
- <fileset dir="." includes="@{file}"/>
- </concat>
- </sequential>
- </macrodef>
-</antlib>
- </pre>
+ <typedef name="if" classname="org.acme.ant.If"/>
+ <typedef name="scriptpathmapper"
+ classname="org.acme.ant.ScriptPathMapper"
+ onerror="ignore"/>
+ <macrodef name="print">
+ <attribute name="file"/>
+ <sequential>
+ <concat taskname="print">
+ <fileset dir="." includes="@{file}"/>
+ </concat>
+ </sequential>
+ </macrodef>
+</antlib></pre>
<p>
- It defines two types or tasks, <i>if</i> and <i>scriptpathmapper</i>.
- This antlib file may be used in a build script as follows:
+ It defines two types or tasks, <code>if</code> and <code>scriptpathmapper</code>. This
+ antlib file may be used in a build script as follows:
</p>
- <pre>
-<typedef file="sample.xml"/>
- </pre>
+ <pre><typedef file="sample.xml"/></pre>
<p>
- The other attributes of <code><typedef></code> may be used as well.
- For example, assuming that the <i>sample.xml</i> is in a jar
- file <i>sample.jar</i> also containing the classes, the
- following build fragment will define the <i>if</i> and <i>scriptpathmapper</i>
- tasks/types and place them in the namespace uri <i>samples:/acme.org</i>.
+ The other attributes of <code><typedef></code> may be used as well. For example,
+ assuming that the <samp>sample.xml</samp> is in a jar file <samp>sample.jar</samp> also
+ containing the classes, the following build fragment will define the <code>if</code>
+ and <code>scriptpathmapper</code> tasks/types and place them in the namespace
+ uri <code>samples:/acme.org</code>.
</p>
<pre>
<typedef resource="org/acme/ant/sample.xml"
- uri="samples:/acme.org"/>
- </pre>
+ uri="samples:/acme.org"/></pre>
<p>
The definitions may then be used as follows:
</p>
<pre>
<sample:if valuetrue="${props}" xmlns:sample="samples:/acme.org">
- <sample:scriptpathmapper language="beanshell">
- some bean shell
- </sample:scriptpathmapper>
-</sample:if>
- </pre>
+ <sample:scriptpathmapper language="beanshell">
+ some bean shell
+ </sample:scriptpathmapper>
+</sample:if></pre>
<h3 id="antlibnamespace">Antlib namespace</h3>
<p>
- The name space URIs with the pattern <b>antlib:<i>java package</i></b>
- are given special treatment.
+ The name space URIs with the pattern <code>antlib:<i>java.package</i></code> are given
+ special treatment.
</p>
<p>
- When Ant encounters a element with a namespace URI with this pattern, it
- will check to see if there is a resource of the name <i>antlib.xml</i> in
- the package directory in the default classpath.
+ When Ant encounters a element with a namespace URI with this pattern, it will check to see
+ if there is a resource of the name <samp>antlib.xml</samp> in the package directory in the
+ default classpath.
</p>
<p>
- For example, assuming that the file <i>antcontrib.jar</i> has been placed
- in the directory <i>${ant.home}/lib</i> and it contains the resource
- <i>net/sf/antcontrib/antlib.xml</i> which has all antcontrib's definitions
- defined, the following build file will automatically load the antcontrib
- definitions at location <i>HERE</i>:
+ For example, assuming that the file <samp>antcontrib.jar</samp> has been placed in the
+ directory <samp>${ant.home}/lib</samp> and it contains the
+ resource <samp>net/sf/antcontrib/antlib.xml</samp> which has all antcontrib's definitions
+ defined, the following build file will automatically load the antcontrib definitions at
+ location <code>HERE</code>:
</p>
<pre>
<project default="deletetest" xmlns:antcontrib="antlib:net.sf.antcontrib">
- <macrodef name="showdir">
- <attribute name="dir"/>
- <sequential>
- <antcontrib:shellscript shell="bash"> <!-- HERE -->
- ls -Rl @{dir}
- </antcontrib:shellscript>
- </sequential>
- </macrodef>
+ <macrodef name="showdir">
+ <attribute name="dir"/>
+ <sequential>
+ <antcontrib:shellscript shell="bash"> <!-- HERE -->
+ ls -Rl @{dir}
+ </antcontrib:shellscript>
+ </sequential>
+ </macrodef>
- <target name="deletetest">
- <delete dir="a" quiet="yes"/>
- <mkdir dir="a/b"/>
- <touch file="a/a.txt"/>
- <touch file="a/b/b.txt"/>
- <delete>
- <fileset dir="a"/>
- </delete>
- <showdir dir="a"/>
- </target>
-</project>
- </pre>
+ <target name="deletetest">
+ <delete dir="a" quiet="yes"/>
+ <mkdir dir="a/b"/>
+ <touch file="a/a.txt"/>
+ <touch file="a/b/b.txt"/>
+ <delete>
+ <fileset dir="a"/>
+ </delete>
+ <showdir dir="a"/>
+ </target>
+</project></pre>
+ <p>
+ The requirement that the resource is in the default classpath may be removed in future
+ versions of Ant.
+ </p>
+ <h3 id="loadFromInside">Load antlib from inside of the buildfile</h3>
<p>
- The requirement that the resource is in the default classpath
- may be removed in future versions of Ant.
+ If you want to separate the antlib from your local Ant installation, e.g. because you want
+ to hold that jar in your project's SCM system, you have to specify a classpath, so that
+ Ant could find that jar. The best solution is loading the antlib
+ with <code><taskdef></code>.
</p>
- <h3 id="loadFromInside">Load antlib from inside of the buildfile</h3>
- <p>
- If you want to separate the antlib from your local Ant installation, e.g. because you
- want to hold that jar in your projects SCM system, you have to specify a classpath, so
- that Ant could find that jar. The best solution is loading the antlib with <tt><taskdef></tt>.
- </p>
<pre>
-<project xmlns:<font color="green">antcontrib</font>="<font color="red">antlib:net.sf.antcontrib</font>">
- <taskdef uri="<font color="red">antlib:net.sf.antcontrib</font>"
- resource="net/sf/antcontrib/antlib.xml"
- classpath="path/to/ant-contrib.jar"/>
+<project xmlns:<span style="color:green">antcontrib</span>="<span style="color:red">antlib:net.sf.antcontrib</span>">
+ <taskdef uri="<span style="color:red">antlib:net.sf.antcontrib</span>"
+ resource="net/sf/antcontrib/antlib.xml"
+ classpath="path/to/ant-contrib.jar"/>
- <target name="iterate">
- <<font color="green">antcontrib</font>:for param="file">
- <fileset dir="."/>
- <sequential>
- <echo message="- @{file}"/>
- </sequential>
- </antcontrib:for>
- </target>
-</project>
- </pre>
+ <target name="iterate">
+ <<span style="color:green">antcontrib</span>:for param="file">
+ <fileset dir="."/>
+ <sequential>
+ <echo message="- @{file}"/>
+ </sequential>
+ </antcontrib:for>
+ </target>
+</project></pre>
<h3 id="currentnamespace">Current namespace</h3>
<p>
- Definitions defined in antlibs may be used in antlibs. However
- the namespace that definitions are placed in are dependent on
- the <code><typedef></code> that uses the antlib. To deal with this
- problem, the definitions are placed in the namespace URI <i>ant:current</i>
- for the duration of the antlib execution.
- For example the following antlib defines the task <code><if></code>, the
- type <code><isallowed></code> and a macro
- <code><ifallowed></code> that makes use of the task and type:
+ Definitions defined in antlibs may be used in antlibs. However, the namespace that
+ definitions are placed in are dependent on the <code><typedef></code> that uses the
+ antlib. To deal with this problem, the definitions are placed in the namespace
+ URI <code>ant:current</code> for the duration of the antlib execution. For example, the
+ following antlib defines the task <code><if></code>, the
+ type <code><isallowed></code> and a macro <code><ifallowed></code> that makes
+ use of the task and type:
</p>
<pre>
<antlib xmlns:current="ant:current">
- <taskdef name="if" classname="org.acme.ant.If"/>
- <typedef name="isallowed" classname="org.acme.ant.Isallowed"/>
- <macrodef name="ifallowed">
- <attribute name="action"/>
- <element name="do"/>
- <sequential>
- <current:if>
- <current:isallowed test="@{action}"/>
- <current:then>
- <do/>
- </current:then>
- </current:if>
- </sequential>
- </macrodef>
-</antlib>
- </pre>
+ <taskdef name="if" classname="org.acme.ant.If"/>
+ <typedef name="isallowed" classname="org.acme.ant.Isallowed"/>
+ <macrodef name="ifallowed">
+ <attribute name="action"/>
+ <element name="do"/>
+ <sequential>
+ <current:if>
+ <current:isallowed test="@{action}"/>
+ <current:then>
+ <do/>
+ </current:then>
+ </current:if>
+ </sequential>
+ </macrodef>
+</antlib></pre>
<h3>Other examples and comments</h3>
<p>
Antlibs may make use of other antlibs.
</p>
<p>
- As the names defined in the antlib are in the namespace uri as
- specified by the calling <code><typedef></code> or by automatic element
- resolution, one may reuse names from core ant types and tasks,
- provided the caller uses a namespace uri. For example, the
- following antlib may be used to define defaults for various
- tasks:
+ As the names defined in the antlib are in the namespace URI as specified by the
+ calling <code><typedef></code> or by automatic element resolution, one may reuse
+ names from core Ant types and tasks, provided the caller uses a namespace URI. For
+ example, the following antlib may be used to define defaults for various tasks:
</p>
<pre>
<antlib xmlns:antcontrib="antlib:net.sf.antcontrib">
- <presetdef name="javac">
- <javac deprecation="${deprecation}"
- debug="${debug}"/>
- </presetdef>
- <presetdef name="delete">
- <delete quiet="yes"/>
- </presetdef>
- <presetdef name="shellscript">
- <antcontrib:shellscript shell="bash"/>
- </presetdef>
-</antlib>
- </pre>
+ <presetdef name="javac">
+ <javac deprecation="${deprecation}"
+ debug="${debug}"/>
+ </presetdef>
+ <presetdef name="delete">
+ <delete quiet="yes"/>
+ </presetdef>
+ <presetdef name="shellscript">
+ <antcontrib:shellscript shell="bash"/>
+ </presetdef>
+</antlib></pre>
<p>
This may be used as follows:
</p>
<pre>
<project xmlns:local="localpresets">
- <typedef file="localpresets.xml" uri="localpresets"/>
- <local:shellscript>
- echo "hello world"
- </local:shellscript>
-</project>
- </pre>
+ <typedef file="localpresets.xml" uri="localpresets"/>
+ <local:shellscript>
+ echo "hello world"
+ </local:shellscript>
+</project></pre>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/ant/blob/66b52f99/manual/Types/assertions.html
----------------------------------------------------------------------
diff --git a/manual/Types/assertions.html b/manual/Types/assertions.html
index 9942b4c..a24d83a 100644
--- a/manual/Types/assertions.html
+++ b/manual/Types/assertions.html
@@ -26,114 +26,112 @@
<h2 id="assertions">Assertions</h2>
<p>
-The <tt>assertions</tt> type enables or disables the Java 1.4 assertions feature,
-on a whole Java program, or components of a program. It can be used
-in <a href="../Tasks/java.html"><code><java></code></a> and
-<a href="../Tasks/junit.html"><code><junit></code></a> to add extra validation to code.
+The <code>assertions</code> type enables or disables the Java 1.4 assertions feature, on a whole
+Java program, or components of a program. It can be used
+in <a href="../Tasks/java.html"><code><java></code></a>
+and <a href="../Tasks/junit.html"><code><junit></code></a> to add extra validation to
+code.
<p>
-Assertions are covered in the
-<a href="http://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html">Java SE documentation</a>,
-and the
-<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.10">Java Language Specification</a>.
+Assertions are covered in
+the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/language/assert.html">Java
+SE documentation</a>, and
+the <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.10">Java
+Language Specification</a>.
<p>
-The key points to note are that a <tt>java.lang.AssertionError</tt>
-is thrown when an assertion fails, and that the facility is only available
-on Java 1.4 and later. To enable assertions one must set <tt>source="1.4"</tt>
-(or later) in <tt><javac></tt> when the source is being compiled, and
-that the code must contain <tt>assert</tt> statements to be tested. The
-result of such an action is code that neither compiles or runs on earlier
+The key points to note are that a <code>java.lang.AssertionError</code> is thrown when an
+assertion fails, and that the facility is only available on Java 1.4 and later. To enable
+assertions one must set <var>source</var>=<q>1.4</q> (or later) in <code><javac></code>
+when the source is being compiled, and that the code must contain <code>assert</code> statements
+to be tested. The result of such an action is code that neither compiles or runs on earlier
versions of Java. For this reason Apache Ant itself currently contains no assertions.
<p>
-When assertions are enabled (or disabled) in a task through nested
-assertions elements, the class loader or command line is modified with the
-appropriate options. This means that the JVM executed must be a Java 1.4
-or later JVM, even if there are no assertions in the code. Attempting to
-enable assertions on earlier VMs will result in an "Unrecognized option"
+When assertions are enabled (or disabled) in a task through nested assertions elements, the
+class loader or command line is modified with the appropriate options. This means that the JVM
+executed must be of version 1.4 or later, even if there are no assertions in the
+code. Attempting to enable assertions on earlier JVMs will result in an "Unrecognized option"
error and the JVM will not start.
<p>
<h4>Attributes</h4>
-<table>
+<table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td align="center" valign="top"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">enableSystemAssertions</td>
- <td valign="top">Flag to turn system assertions on or off.</td>
- <td valign="top" align="center">No; default is "unspecified"</td>
+ <td>enableSystemAssertions</td>
+ <td>Flag to turn system assertions on or off.</td>
+ <td>No; default is <q>unspecified</q></td>
</tr>
</table>
<p>
-When system assertions have been neither enabled nor disabled, then
-the JVM is not given any assertion information - the default action of the
- current JVMs is to disable system assertions.
+When system assertions have been neither enabled nor disabled, then the JVM is not given any
+assertion information—the default action of the current JVMs is to disable system
+assertions.
<p>
-Note also that there is no apparent documentation for what parts of the
-JRE come with useful assertions.
+Note also that there is no apparent documentation for what parts of the JRE come with useful
+assertions.
<h3>Nested elements</h3>
<h4>enable</h4>
<p>
-Enable assertions in portions of code.
-If neither a package nor class is specified, assertions are turned on in <i>all</i> (user) code.
+Enable assertions in portions of code. If neither a package nor class is specified, assertions
+are turned on in <em>all</em> (user) code.
</p>
-<table>
+<table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td align="center" valign="top"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">class</td>
- <td valign="top">The name of a class on which to enable assertions.</td>
- <td valign="top" align="center">No</td>
+ <td>class</td>
+ <td>The name of a class on which to enable assertions.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">package</td>
- <td valign="top">
+ <td>package</td>
+ <td>
The name of a package in which to enable assertions on all classes. (Includes subpackages.)
- Use "<tt>...</tt>" for the anonymous package.
+ Use <q>...</q> for the anonymous package.
</td>
- <td valign="top" align="center">No</td>
+ <td>No</td>
</tr>
</table>
<h4>disable</h4>
<p>
Disable assertions in portions of code.
-
</p>
-<table>
+<table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td align="center" valign="top"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">class</td>
- <td valign="top">The name of a class on which to disable assertions.</td>
- <td valign="top" align="center">No</td>
+ <td>class</td>
+ <td>The name of a class on which to disable assertions.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">package</td>
- <td valign="top">
+ <td>package</td>
+ <td>
The name of a package in which to disable assertions on all classes. (Includes subpackages.)
- Use "<tt>...</tt>" for the anonymous package.
+ Use <q>...</q> for the anonymous package.
</td>
- <td valign="top" align="center">No</td>
+ <td>No</td>
</tr>
</table>
<p>
-
-Because assertions are disabled by default, it only makes sense to disable
-assertions where they have been enabled in a parent package.
-
+Because assertions are disabled by default, it only makes sense to disable assertions where they
+have been enabled in a parent package.
+</p>
<h4>Examples</h4>
<h5>Example: enable assertions in all user classes</h5>
@@ -156,8 +154,8 @@ Enable assertions in a class called Test
<h5>Example: enable a package</h5>
-Enable assertions in the <tt>org.apache</tt> package
-and all packages starting with the <tt>org.apache.</tt> prefix
+Enable assertions in the <code>org.apache</code> package and all packages starting with
+the <code>org.apache.</code> prefix
<pre>
<assertions>
<enable package="org.apache"/>
@@ -166,8 +164,8 @@ and all packages starting with the <tt>org.apache.</tt> prefix
<h5>Example: System assertions</h5>
-Example: enable system assertions and assertions in all <tt>org.apache</tt> packages except
-for Ant (but including <tt>org.apache.tools.ant.Main</tt>)
+Enable system assertions and assertions in all <code>org.apache</code> packages except for Ant
+(but including <code>org.apache.tools.ant.Main</code>)
<pre>
<assertions enableSystemAssertions="true">
<enable package="org.apache"/>
@@ -188,7 +186,6 @@ Disable system assertions; enable those in the anonymous package
<h5>Example: referenced assertions</h5>
This type is a datatype, so you can declare assertions and use them later
-
<pre>
<assertions id="project.assertions">
<enable package="org.apache.test"/>
http://git-wip-us.apache.org/repos/asf/ant/blob/66b52f99/manual/Types/classfileset.html
----------------------------------------------------------------------
diff --git a/manual/Types/classfileset.html b/manual/Types/classfileset.html
index 5f25108..5e592a4 100644
--- a/manual/Types/classfileset.html
+++ b/manual/Types/classfileset.html
@@ -23,36 +23,35 @@
<body>
<h2 id="fileset">ClassFileSet</h2>
-<p>A classfileset is a specialized type of fileset which, given a set of
-"root" classes, will include all of the class files upon which the
-root classes depend. This is typically used to create a jar with all of the
-required classes for a particular application.
+<p>A classfileset is a specialized type of fileset which, given a set of "root"
+classes, will include all of the class files upon which the root classes depend. This is
+typically used to create a jar with all of the required classes for a particular application.
</p>
<p>
-classfilesets are typically used by reference. They are declared with an
-"id" value and this is then used as a reference where a normal fileset
-is expected.
+classfilesets are typically used by reference. They are declared with an <var>id</var> value and
+this is then used as a reference where a normal fileset is expected.
</p>
<p>
-This type requires the <code>BCEL</code> <a href="../install.html#librarydependencies">library</a>.
+This type requires
+the <code>BCEL</code> <a href="../install.html#librarydependencies">library</a>.
</p>
<h3>Attributes</h3>
-<p>The class fileset support the following attributes in addition
-to those supported by the
-<a href="fileset.html">standard fileset</a>:
+<p>
+The class fileset support the following attributes in addition to those supported by
+the <a href="fileset.html">standard fileset</a>:
</p>
-<table>
+<table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td align="center" valign="top"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">rootclass</td>
- <td valign="top">A single root class name</td>
- <td valign="top" align="center">No</td>
+ <td>rootclass</td>
+ <td>A single root class name</td>
+ <td>No</td>
</tr>
</table>
@@ -63,16 +62,16 @@ to those supported by the
When more than one root class is required, multiple nested <code><root></code> elements
may be used
</p>
-<table>
+<table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td align="center" valign="top"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">classname</td>
- <td valign="top">The fully qualified name of the root class</td>
- <td align="center" valign="top">Yes</td>
+ <td>classname</td>
+ <td>The fully qualified name of the root class</td>
+ <td>Yes</td>
</tr>
</table>
@@ -80,36 +79,34 @@ may be used
<p>
A root fileset is used to add a set of root classes from a fileset. In this case the entries in
the fileset are expected to be Java class files. The name of the Java class is determined by the
-relative location of the classfile in the fileset. So, the file
-<code>org/apache/tools/ant/Project.class</code> corresponds to the Java class
-<code>org.apache.tools.ant.Project</code>.</p>
+relative location of the classfile in the fileset. So, the
+file <code>org/apache/tools/ant/Project.class</code> corresponds to the Java
+class <code>org.apache.tools.ant.Project</code>.</p>
<h4>Examples</h4>
<pre>
<classfileset id="reqdClasses" dir="${classes.dir}">
<root classname="org.apache.tools.ant.Project"/>
-</classfileset>
-</pre>
-
-<p>This example creates a fileset containing all the class files upon which the
-<code>org.apache.tools.ant.Project</code> class depends. This fileset could
-then be used to create a jar.
+</classfileset></pre>
+<p>
+This example creates a fileset containing all the class files upon which
+the <code>org.apache.tools.ant.Project</code> class depends. This fileset could then be used to
+create a jar.
</p>
<pre>
<jar destfile="minimal.jar">
<fileset refid="reqdClasses"/>
-</jar>
-</pre>
+</jar></pre>
<pre>
<classfileset id="reqdClasses" dir="${classes.dir}">
<rootfileset dir="${classes.dir}" includes="org/apache/tools/ant/Project*.class"/>
-</classfileset>
-</pre>
-
-<p>This example constructs the classfileset using all the class with names starting with Project
-in the org.apache.tools.ant package</p>
+</classfileset></pre>
+<p>
+This example constructs the classfileset using all the class with names starting with Project in
+the <samp>org.apache.tools.ant</samp> package.
+</p>
</body>
</html>