You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

zipfileset.html 6.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  16. <html>
  17. <head>
  18. <meta http-equiv="Content-Language" content="en-us">
  19. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  20. <title>ZipFileSet Type</title>
  21. </head>
  22. <body>
  23. <h2><a name="fileset">ZipFileSet</a></h2>
  24. <p>A <code>&lt;zipfileset&gt;</code> is a special form of a <code>&lt;<a
  25. href="fileset.html">fileset</a>&gt;</code> which can behave in 2
  26. different ways : <br>
  27. </p>
  28. <ul>
  29. <li>When the <span style="font-style: italic;">src</span> attribute
  30. is used - or a nested resource collection has been specified
  31. (<em>since Apache Ant 1.7</em>), the zipfileset is populated with
  32. zip entries found in the file <span style="font-style:
  33. italic;">src</span>.<br>
  34. </li>
  35. <li>When the <span style="font-style: italic;">dir</span> attribute
  36. is used, the zipfileset is populated with filesystem files found under <span
  37. style="font-style: italic;">dir</span>.<br>
  38. </li>
  39. </ul>
  40. <p><code>&lt;zipfileset&gt;</code> supports all attributes of <code>&lt;<a
  41. href="fileset.html">fileset</a>&gt;</code>
  42. in addition to those listed below.<br>
  43. </p>
  44. <p>Since Ant 1.6, a zipfileset can be defined with the <span
  45. style="font-style: italic;">id </span>attribute and referred to with
  46. the <span style="font-style: italic;">refid</span> attribute.<br>
  47. </p>
  48. <h3>Parameters</h3>
  49. <table border="1" cellpadding="2" cellspacing="0">
  50. <tbody>
  51. <tr>
  52. <td valign="top"><b>Attribute</b></td>
  53. <td valign="top"><b>Description</b></td>
  54. <td valign="top" align="center"><b>Required</b></td>
  55. </tr>
  56. <tr>
  57. <td valign="top">prefix</td>
  58. <td valign="top">all files in the fileset are prefixed with that
  59. path in the archive.</td>
  60. <td align="center" valign="top">No</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">fullpath</td>
  64. <td valign="top">the file described by the fileset is placed at
  65. that exact location in the archive.</td>
  66. <td align="center" valign="top">No</td>
  67. </tr>
  68. <tr>
  69. <td valign="top">src</td>
  70. <td valign="top">may be used in place of the <i>dir</i> attribute
  71. to specify a zip file whose contents will be extracted and included
  72. in the archive.</td>
  73. <td align="center" valign="top">No</td>
  74. </tr>
  75. <tr>
  76. <td valign="top">filemode</td>
  77. <td valign="top">A 3 digit octal string, specify the user, group
  78. and other modes in the standard Unix fashion. Only applies to
  79. plain files. Default is 644. <em>since Ant 1.5.2</em>.</td>
  80. <td align="center" valign="top">No</td>
  81. </tr>
  82. <tr>
  83. <td valign="top">dirmode</td>
  84. <td valign="top">A 3 digit octal string, specify the user, group
  85. and other modes in the standard Unix fashion. Only applies to
  86. directories. Default is 755. <em>since Ant 1.5.2</em>.</td>
  87. <td align="center" valign="top">No</td>
  88. </tr>
  89. <tr>
  90. <td valign="top">encoding</td>
  91. <td valign="top">The character encoding to use for filenames
  92. inside the zip file. For a list of possible values see <a
  93. href="http://download.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html">http://download.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html</a>.
  94. Defaults to the platform's default character encoding.
  95. <b>Only supported by zipfileset.</b></td>
  96. <td align="center" valign="top">No</td>
  97. </tr>
  98. <tr>
  99. <td valign="top">erroronmissingarchive</td>
  100. <td valign="top">
  101. Specify what happens if the archive does not exist.
  102. If true, a build error will happen; if false, the fileset
  103. will be ignored/empty.
  104. Defaults to true.
  105. <em>Since Ant 1.8.0</em>
  106. </td>
  107. <td valign="top" align="center">No</td>
  108. </tr>
  109. </tbody>
  110. </table>
  111. <p>The <i>fullpath</i> attribute can only be set for filesets that
  112. represent a single file. The <i>prefix</i> and <i>fullpath</i>
  113. attributes cannot both be set on the same fileset.</p>
  114. <p>When using the <i>src</i> attribute, include and exclude patterns
  115. may be used to specify a subset of the archive for inclusion in the
  116. archive as with the <i>dir</i> attribute.</p>
  117. <p>Please note that currently only the <a
  118. href="../Tasks/tar.html">tar</a> and <a
  119. href="../Tasks/zip.html">zip</a> tasks use the permission.</p>
  120. <h3>Parameters specified as nested elements</h3>
  121. <h4>any file system based <a href="resources.html">resource</a> or
  122. single element resource collection</h4>
  123. <p>The specified resource will be used as src.</p>
  124. <h4>Examples</h4>
  125. <blockquote>
  126. <pre> &lt;zip destfile="${dist}/manual.zip"&gt;<br> &lt;zipfileset dir="htdocs/manual" prefix="docs/user-guide"/&gt;<br> &lt;zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/&gt;<br> &lt;zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/&gt;<br> &lt;/zip&gt;<br></pre>
  127. <p>zips all files in the <code>htdocs/manual</code> directory into
  128. the <code>docs/user-guide</code> directory in the archive, adds the
  129. file <code>ChangeLog27.txt</code> in the current directory as <code>docs/ChangeLog.txt</code>,
  130. and includes all the html files in <code>examples.zip</code> under <code>docs/examples</code>.
  131. The archive might end up containing the files:</p>
  132. <code> docs/user-guide/html/index.html<br>
  133. docs/ChangeLog.txt<br>
  134. docs/examples/index.html<br>
  135. </code></blockquote>
  136. </body>
  137. </html>