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.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>ZipFileSet Type</title>
  20. </head>
  21. <body>
  22. <h2 id="fileset">ZipFileSet</h2>
  23. <p>A <code>&lt;zipfileset&gt;</code> is a special form of a <code>&lt;<a
  24. href="fileset.html">fileset</a>&gt;</code> which can behave in 2
  25. different ways : <br>
  26. </p>
  27. <ul>
  28. <li>When the <span style="font-style: italic;">src</span> attribute
  29. is used - or a nested resource collection has been specified
  30. (<em>since Apache Ant 1.7</em>), the zipfileset is populated with
  31. zip entries found in the file <span style="font-style:
  32. italic;">src</span>.<br>
  33. </li>
  34. <li>When the <span style="font-style: italic;">dir</span> attribute
  35. is used, the zipfileset is populated with filesystem files found under <span
  36. style="font-style: italic;">dir</span>.<br>
  37. </li>
  38. </ul>
  39. <p><code>&lt;zipfileset&gt;</code> supports all attributes of <code>&lt;<a
  40. href="fileset.html">fileset</a>&gt;</code>
  41. in addition to those listed below. Note that zip archives in general
  42. don't contain entries with leading slashes so you shouldn't use
  43. include/exclude patterns that start with slashes either.</p>
  44. <p><em>Since Ant 1.6</em>, 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>
  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 the <a
  93. href="http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a>.
  94. Defaults to the platform's default character encoding.
  95. <td align="center" valign="top">No</td>
  96. </tr>
  97. <tr>
  98. <td valign="top">erroronmissingarchive</td>
  99. <td valign="top">
  100. Specify what happens if the archive does not exist.
  101. If true, a build error will happen; if false, the fileset
  102. will be ignored/empty.
  103. Defaults to true.
  104. <em>Since Ant 1.8.0</em>
  105. </td>
  106. <td valign="top" align="center">No</td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. <p>The <i>fullpath</i> attribute can only be set for filesets that
  111. represent a single file. The <i>prefix</i> and <i>fullpath</i>
  112. attributes cannot both be set on the same fileset.</p>
  113. <p>When using the <i>src</i> attribute, include and exclude patterns
  114. may be used to specify a subset of the archive for inclusion in the
  115. archive as with the <i>dir</i> attribute.</p>
  116. <p>Please note that currently only the <a
  117. href="../Tasks/tar.html">tar</a> and <a
  118. href="../Tasks/zip.html">zip</a> tasks use the permission.</p>
  119. <h3>Parameters specified as nested elements</h3>
  120. <h4>any file system based <a href="resources.html">resource</a> or
  121. single element resource collection</h4>
  122. <p>The specified resource will be used as src.</p>
  123. <h4>Examples</h4>
  124. <blockquote>
  125. <pre> &lt;zip destfile="${dist}/manual.zip"&gt;
  126. &lt;zipfileset dir="htdocs/manual" prefix="docs/user-guide"/&gt;
  127. &lt;zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/&gt;
  128. &lt;zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/&gt;
  129. &lt;/zip&gt;</pre>
  130. <p>zips all files in the <code>htdocs/manual</code> directory into
  131. the <code>docs/user-guide</code> directory in the archive, adds the
  132. file <code>ChangeLog27.txt</code> in the current directory as <code>docs/ChangeLog.txt</code>,
  133. and includes all the html files in <code>examples.zip</code> under <code>docs/examples</code>.
  134. The archive might end up containing the files:</p>
  135. <code>docs/user-guide/html/index.html<br>
  136. docs/ChangeLog.txt<br>
  137. docs/examples/index.html<br>
  138. </code></blockquote>
  139. </body>
  140. </html>