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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. https://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <html lang="en">
  17. <head>
  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
  24. a <code>&lt;<a href="fileset.html">fileset</a>&gt;</code> which can behave in 2 different ways:</p>
  25. <ul>
  26. <li>When the <var>src</var> attribute is used&mdash;or a nested resource collection has been
  27. specified (<em>since Apache Ant 1.7</em>), the zipfileset is populated with zip entries found in
  28. the file <var>src</var>.</li>
  29. <li>When the <var>dir</var> attribute is used, the zipfileset is populated with filesystem files
  30. found under <var>dir</var>.</li>
  31. </ul>
  32. <p><code>&lt;zipfileset&gt;</code> supports all attributes
  33. of <code>&lt;<a href="fileset.html">fileset</a>&gt;</code> in addition to those listed below. Note
  34. that zip archives in general don't contain entries with leading slashes so you shouldn't
  35. use <var>includes</var>/<var>excludes</var> patterns that start with slashes either.</p>
  36. <p><em>Since Ant 1.6</em>, a zipfileset can be defined with the <var>id</var> attribute and referred
  37. to with the <var>refid</var> attribute.</p>
  38. <h3>Parameters</h3>
  39. <table class="attr">
  40. <tbody>
  41. <tr>
  42. <th scope="col">Attribute</th>
  43. <th scope="col">Description</th>
  44. <th scope="col">Required</th>
  45. </tr>
  46. <tr>
  47. <td>prefix</td>
  48. <td>all files in the fileset are prefixed with that path in the archive.</td>
  49. <td>No</td>
  50. </tr>
  51. <tr>
  52. <td>fullpath</td>
  53. <td>the file described by the fileset is placed at that exact location in the archive.</td>
  54. <td>No</td>
  55. </tr>
  56. <tr>
  57. <td>src</td>
  58. <td>may be used in place of the <var>dir</var> attribute to specify a zip file whose contents
  59. will be extracted and included in the archive.</td>
  60. <td>No</td>
  61. </tr>
  62. <tr>
  63. <td>filemode</td>
  64. <td>A 3 digit octal string, specify the user, group and other modes in the standard Unix
  65. fashion. Only applies to plain files. <em>Since Ant 1.5.2</em></td>
  66. <td>No; default is <q>644</q></td>
  67. </tr>
  68. <tr>
  69. <td>dirmode</td>
  70. <td>A 3 digit octal string, specify the user, group and other modes in the standard Unix
  71. fashion. Only applies to directories. <em>Since Ant 1.5.2</em></td>
  72. <td>No; default is <q>755</q></td>
  73. </tr>
  74. <tr>
  75. <td>encoding</td>
  76. <td>The character encoding to use for filenames inside the zip file. For a list of possible
  77. values see
  78. the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html"
  79. target="_top">Supported Encodings</a>.
  80. <td>No; defaults to default JVM character encoding</td>
  81. </tr>
  82. <tr>
  83. <td>erroronmissingarchive</td>
  84. <td>Specify what happens if the archive does not exist. If <q>true</q>, a build error will
  85. happen; if <q>false</q>, the fileset will be ignored/empty. <em>Since Ant 1.8.0</em></td>
  86. <td>No; defaults to <q>true</q></td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. <p>The <var>fullpath</var> attribute can only be set for filesets that represent a single
  91. file. The <var>prefix</var> and <var>fullpath</var> attributes cannot both be set on the same
  92. fileset.</p>
  93. <p>When using the <var>src</var> attribute, <var>includes</var> and <var>excludes</var> patterns
  94. may be used to specify a subset of the archive for inclusion in the archive as with
  95. the <var>dir</var> attribute.</p>
  96. <p>Please note that currently only the <a href="../Tasks/tar.html">tar</a>
  97. and <a href="../Tasks/zip.html">zip</a> tasks use the permission.</p>
  98. <h3>Parameters specified as nested elements</h3>
  99. <h4>any file system based <a href="resources.html">resource</a> or single element resource
  100. collection</h4>
  101. <p>The specified resource will be used as <var>src</var>.</p>
  102. <h4>Examples</h4>
  103. <pre>
  104. &lt;zip destfile="${dist}/manual.zip"&gt;
  105. &lt;zipfileset dir="htdocs/manual" prefix="docs/user-guide"/&gt;
  106. &lt;zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/&gt;
  107. &lt;zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/&gt;
  108. &lt;/zip&gt;</pre>
  109. <p>zips all files in the <samp>htdocs/manual</samp> directory into
  110. the <samp>docs/user-guide</samp> directory in the archive, adds the
  111. file <samp>ChangeLog27.txt</samp> in the current directory as <samp>docs/ChangeLog.txt</samp>,
  112. and includes all the html files in <samp>examples.zip</samp> under <samp>docs/examples</samp>.
  113. The archive might end up containing the files:</p>
  114. <pre>docs/user-guide/html/index.html
  115. docs/ChangeLog.txt
  116. docs/examples/index.html</pre>
  117. </body>
  118. </html>