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

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