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.

unzip.html 4.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  5. <title>Unzip Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="unzip">Unjar/Untar/Unwar/Unzip</a></h2>
  9. <h3>Description</h3>
  10. <p>Unzips a zip-, war-, or jar file.</p>
  11. <p><a href="../CoreTypes/patternset.html">PatternSet</a>s are used to select files to extract
  12. <I>from</I> the archive. If no patternset is used, all files are extracted.
  13. </p>
  14. <p><a href="../CoreTypes/resources.html#collection">Resource
  15. Collection</a>s may be used to select archived files to perform
  16. unarchival upon. Only file system based resource collections are
  17. supported by Unjar/Unwar/Unzip, this includes <a
  18. href="../CoreTypes/fileset.html">fileset</a>s, <a
  19. href="../CoreTypes/filelist.html">filelist</a> and <a
  20. href="../using.html#path">path</a>. Untar supports arbitrary resource
  21. collections. Prior to Ant 1.7 only fileset has been supported as a
  22. nested element.</p>
  23. <p>You can define filename transformations by using a nested <a href="../CoreTypes/mapper.html">mapper</a> element. The default mapper is the
  24. <a href="../CoreTypes/mapper.html#identity-mapper">identity mapper</a>.
  25. </p>
  26. <p>File permissions will not be restored on extracted files.</p>
  27. <p>The untar task recognizes the long pathname entries used by GNU tar.<p>
  28. <h3>Parameters</h3>
  29. <table border="1" cellpadding="2" cellspacing="0">
  30. <tr>
  31. <td valign="top"><b>Attribute</b></td>
  32. <td valign="top"><b>Description</b></td>
  33. <td align="center" valign="top"><b>Required</b></td>
  34. </tr>
  35. <tr>
  36. <td valign="top">src</td>
  37. <td valign="top">archive file to expand.</td>
  38. <td align="center" valign="top">Yes, if filesets are not used.</td>
  39. </tr>
  40. <tr>
  41. <td valign="top">dest</td>
  42. <td valign="top">directory where to store the expanded files.</td>
  43. <td align="center" valign="top">Yes</td>
  44. </tr>
  45. <tr>
  46. <td valign="top">overwrite</td>
  47. <td valign="top">Overwrite files, even if they are newer than the
  48. corresponding entries in the archive (true or false, default is
  49. true).</td>
  50. <td align="center" valign="top">No</td>
  51. </tr>
  52. <tr>
  53. <td valign="top">compression</td>
  54. <td valign="top"><b>Note:</b> This attribute is only available for
  55. the <code>untar</code> task.<br>
  56. compression method. Allowable values are &quot;none&quot;,
  57. &quot;gzip&quot; and &quot;bzip2&quot;. Default is
  58. &quot;none&quot;.</td>
  59. <td valign="top" align="center">No</td>
  60. </tr>
  61. <tr>
  62. <td valign="top">encoding</td>
  63. <td valign="top"><b>Note:</b> This attribute is not available for
  64. the <code>untar</code> task.<br>
  65. The character encoding that has been used for filenames
  66. inside the zip file. For a list of possible values see <a
  67. href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html">http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html</a>.<br>
  68. Defaults to &quot;UTF8&quot;, use the magic value
  69. <code>native-encoding</code> for the platform's default character
  70. encoding.</td>
  71. <td align="center" valign="top">No</td>
  72. </tr>
  73. </table>
  74. <h3>Examples</h3>
  75. <pre>
  76. &lt;unzip src=&quot;${tomcat_src}/tools-src.zip&quot; dest=&quot;${tools.home}&quot;/&gt;
  77. </pre>
  78. <p>
  79. <pre>
  80. &lt;gunzip src=&quot;tools.tar.gz&quot;/&gt;
  81. &lt;untar src=&quot;tools.tar&quot; dest=&quot;${tools.home}&quot;/&gt;
  82. </pre>
  83. <pre>
  84. &lt;unzip src=&quot;${tomcat_src}/tools-src.zip&quot;
  85. dest=&quot;${tools.home}&quot;&gt;
  86. &lt;patternset&gt;
  87. &lt;include name=&quot;**/*.java&quot;/&gt;
  88. &lt;exclude name=&quot;**/Test*.java&quot;/&gt;
  89. &lt;/patternset&gt;
  90. &lt;/unzip&gt;
  91. </pre>
  92. <p>
  93. <pre>
  94. &lt;unzip dest=&quot;${tools.home}&quot;&gt;
  95. &lt;patternset&gt;
  96. &lt;include name=&quot;**/*.java&quot;/&gt;
  97. &lt;exclude name=&quot;**/Test*.java&quot;/&gt;
  98. &lt;/patternset&gt;
  99. &lt;fileset dir=&quot;.&quot;&gt;
  100. &lt;include name=&quot;**/*.zip&quot;/&gt;
  101. &lt;exclude name=&quot;**/tmp*.zip&quot;/&gt;
  102. &lt;/fileset&gt;
  103. &lt;/unzip&gt;
  104. </pre>
  105. <p>
  106. <pre>
  107. &lt;unzip src=&quot;apache-ant-bin.zip&quot; dest=&quot;${tools.home}&quot;&gt;
  108. &lt;patternset&gt;
  109. &lt;include name=&quot;apache-ant/lib/ant.jar&quot;/&gt;
  110. &lt;/patternset&gt;
  111. &lt;mapper type=&quot;flatten&quot;/&gt;
  112. &lt;/unzip&gt;
  113. </pre>
  114. <hr>
  115. <p align="center">Copyright &copy; 2000-2005 The Apache Software Foundation. All rights
  116. Reserved.</p>
  117. </body>
  118. </html>