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 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. Note that zip archives in general
  43. don't contain entries with leading slashes so you shouldn't use
  44. include/exclude patterns that start with slashes either.</p>
  45. <p>Since Ant 1.6, a zipfileset can be defined with the <span
  46. style="font-style: italic;">id </span>attribute and referred to with
  47. the <span style="font-style: italic;">refid</span> attribute.<br>
  48. </p>
  49. <h3>Parameters</h3>
  50. <table border="1" cellpadding="2" cellspacing="0">
  51. <tbody>
  52. <tr>
  53. <td valign="top"><b>Attribute</b></td>
  54. <td valign="top"><b>Description</b></td>
  55. <td valign="top" align="center"><b>Required</b></td>
  56. </tr>
  57. <tr>
  58. <td valign="top">prefix</td>
  59. <td valign="top">all files in the fileset are prefixed with that
  60. path in the archive.</td>
  61. <td align="center" valign="top">No</td>
  62. </tr>
  63. <tr>
  64. <td valign="top">fullpath</td>
  65. <td valign="top">the file described by the fileset is placed at
  66. that exact location in the archive.</td>
  67. <td align="center" valign="top">No</td>
  68. </tr>
  69. <tr>
  70. <td valign="top">src</td>
  71. <td valign="top">may be used in place of the <i>dir</i> attribute
  72. to specify a zip file whose contents will be extracted and included
  73. in the archive.</td>
  74. <td align="center" valign="top">No</td>
  75. </tr>
  76. <tr>
  77. <td valign="top">filemode</td>
  78. <td valign="top">A 3 digit octal string, specify the user, group
  79. and other modes in the standard Unix fashion. Only applies to
  80. plain files. Default is 644. <em>since Ant 1.5.2</em>.</td>
  81. <td align="center" valign="top">No</td>
  82. </tr>
  83. <tr>
  84. <td valign="top">dirmode</td>
  85. <td valign="top">A 3 digit octal string, specify the user, group
  86. and other modes in the standard Unix fashion. Only applies to
  87. directories. Default is 755. <em>since Ant 1.5.2</em>.</td>
  88. <td align="center" valign="top">No</td>
  89. </tr>
  90. <tr>
  91. <td valign="top">encoding</td>
  92. <td valign="top">The character encoding to use for filenames
  93. inside the zip file. For a list of possible values see the <a
  94. href="http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a>.
  95. Defaults to the platform's default character encoding.
  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>