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 5.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 <var>src</var> 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 <var>src</var>.
  32. </li>
  33. <li>When the <var>dir</var> attribute
  34. is used, the zipfileset is populated with filesystem files found under <var>dir</var>.
  35. </li>
  36. </ul>
  37. <p><code>&lt;zipfileset&gt;</code> supports all attributes of <code>&lt;<a
  38. href="fileset.html">fileset</a>&gt;</code>
  39. in addition to those listed below. Note that zip archives in general
  40. don't contain entries with leading slashes so you shouldn't use
  41. include/exclude patterns that start with slashes either.</p>
  42. <p><em>Since Ant 1.6</em>, a zipfileset can be defined with the <var>id </var> attribute and referred to with
  43. the <var>refid</var> attribute.</p>
  44. <h3>Parameters</h3>
  45. <table>
  46. <tbody>
  47. <tr>
  48. <td valign="top"><b>Attribute</b></td>
  49. <td valign="top"><b>Description</b></td>
  50. <td valign="top" align="center"><b>Required</b></td>
  51. </tr>
  52. <tr>
  53. <td valign="top">prefix</td>
  54. <td valign="top">all files in the fileset are prefixed with that
  55. path in the archive.</td>
  56. <td align="center" valign="top">No</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">fullpath</td>
  60. <td valign="top">the file described by the fileset is placed at
  61. that exact location in the archive.</td>
  62. <td align="center" valign="top">No</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">src</td>
  66. <td valign="top">may be used in place of the <i>dir</i> attribute
  67. to specify a zip file whose contents will be extracted and included
  68. in the archive.</td>
  69. <td align="center" valign="top">No</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">filemode</td>
  73. <td valign="top">A 3 digit octal string, specify the user, group
  74. and other modes in the standard Unix fashion. Only applies to
  75. plain files. Default is 644. <em>Since Ant 1.5.2</em></td>
  76. <td align="center" valign="top">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">dirmode</td>
  80. <td valign="top">A 3 digit octal string, specify the user, group
  81. and other modes in the standard Unix fashion. Only applies to
  82. directories. Default is 755. <em>Since Ant 1.5.2</em></td>
  83. <td align="center" valign="top">No</td>
  84. </tr>
  85. <tr>
  86. <td valign="top">encoding</td>
  87. <td valign="top">The character encoding to use for filenames
  88. inside the zip file. For a list of possible values see the <a
  89. href="http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a>.
  90. Defaults to the platform's default character encoding.
  91. <td align="center" valign="top">No</td>
  92. </tr>
  93. <tr>
  94. <td valign="top">erroronmissingarchive</td>
  95. <td valign="top">
  96. Specify what happens if the archive does not exist.
  97. If true, a build error will happen; if false, the fileset
  98. will be ignored/empty.
  99. Defaults to true.
  100. <em>Since Ant 1.8.0</em>
  101. </td>
  102. <td valign="top" align="center">No</td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. <p>The <i>fullpath</i> attribute can only be set for filesets that
  107. represent a single file. The <i>prefix</i> and <i>fullpath</i>
  108. attributes cannot both be set on the same fileset.</p>
  109. <p>When using the <i>src</i> attribute, include and exclude patterns
  110. may be used to specify a subset of the archive for inclusion in the
  111. archive as with the <i>dir</i> attribute.</p>
  112. <p>Please note that currently only the <a
  113. href="../Tasks/tar.html">tar</a> and <a
  114. href="../Tasks/zip.html">zip</a> tasks use the permission.</p>
  115. <h3>Parameters specified as nested elements</h3>
  116. <h4>any file system based <a href="resources.html">resource</a> or
  117. single element resource collection</h4>
  118. <p>The specified resource will be used as src.</p>
  119. <h4>Examples</h4>
  120. <pre> &lt;zip destfile="${dist}/manual.zip"&gt;
  121. &lt;zipfileset dir="htdocs/manual" prefix="docs/user-guide"/&gt;
  122. &lt;zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/&gt;
  123. &lt;zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/&gt;
  124. &lt;/zip&gt;</pre>
  125. <p>zips all files in the <code>htdocs/manual</code> directory into
  126. the <code>docs/user-guide</code> directory in the archive, adds the
  127. file <code>ChangeLog27.txt</code> in the current directory as <code>docs/ChangeLog.txt</code>,
  128. and includes all the html files in <code>examples.zip</code> under <code>docs/examples</code>.
  129. The archive might end up containing the files:</p>
  130. <pre>docs/user-guide/html/index.html
  131. docs/ChangeLog.txt
  132. docs/examples/index.html</pre>
  133. </body>
  134. </html>