aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/manual/Types/zipfileset.html
blob: 955e2718e668c96d045d6090139ccda41db04831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Language" content="en-us">
  <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
<title>ZipFileSet Type</title>
</head>
<body>
<h2><a name="fileset">ZipFileSet</a></h2>

<p>A <code>&lt;zipfileset&gt;</code> is a special form of a <code>&lt;<a
 href="fileset.html">fileset</a>&gt;</code> which can behave in 2
different ways : <br>
</p>
<ul>
  <li>When the <span style="font-style: italic;">src</span> attribute
  is used - or a nested resource collection has been specified
  (<em>since Apache Ant 1.7</em>), the zipfileset is populated with 
  zip entries found in the file <span style="font-style:
  italic;">src</span>.<br>
  </li>
  <li>When the <span style="font-style: italic;">dir</span> attribute
is used, the zipfileset is populated with filesystem files found under <span
 style="font-style: italic;">dir</span>.<br>
  </li>
</ul>
<p><code>&lt;zipfileset&gt;</code> supports all attributes of <code>&lt;<a
 href="fileset.html">fileset</a>&gt;</code>
 in addition to those listed below.  Note that zip archives in general
 don't contain entries with leading slashes so you shouldn't use
 include/exclude patterns that start with slashes either.</p>

<p>Since Ant 1.6, a zipfileset can be defined with the <span
 style="font-style: italic;">id </span>attribute and referred to with
the <span style="font-style: italic;">refid</span> attribute.<br>
</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <td valign="top"><b>Attribute</b></td>
      <td valign="top"><b>Description</b></td>
      <td valign="top" align="center"><b>Required</b></td>
    </tr>
    <tr>
      <td valign="top">prefix</td>
      <td valign="top">all files in the fileset are prefixed with that 
path in the archive.</td>
      <td align="center" valign="top">No</td>
    </tr>
    <tr>
      <td valign="top">fullpath</td>
      <td valign="top">the file described by the fileset is placed at  
that exact location in the archive.</td>
      <td align="center" valign="top">No</td>
    </tr>
    <tr>
      <td valign="top">src</td>
      <td valign="top">may be used in place of the <i>dir</i> attribute
 to specify a zip file whose contents will be extracted and     included
in the archive.</td>
      <td align="center" valign="top">No</td>
    </tr>
    <tr>
      <td valign="top">filemode</td>
      <td valign="top">A 3 digit octal string, specify the user, group 
and other modes in the standard Unix fashion.  Only applies to    
plain files.  Default is 644. <em>since Ant 1.5.2</em>.</td>
      <td align="center" valign="top">No</td>
    </tr>
    <tr>
      <td valign="top">dirmode</td>
      <td valign="top">A 3 digit octal string, specify the user, group 
and other modes in the standard Unix fashion.  Only applies to    
directories.  Default is 755. <em>since Ant 1.5.2</em>.</td>
      <td align="center" valign="top">No</td>
    </tr>
    <tr>
      <td valign="top">encoding</td>
      <td valign="top">The character encoding to use for filenames
      inside the zip file.  For a list of possible values see the <a
      href="http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a>.
      Defaults to the platform's default character encoding.
      <td align="center" valign="top">No</td>
    </tr>
    <tr>
      <td valign="top">erroronmissingarchive</td>
      <td valign="top">
        Specify what happens if the archive does not exist.
        If true, a build error will happen; if false, the fileset
        will be ignored/empty.
        Defaults to true.
        <em>Since Ant 1.8.0</em>
      </td>
      <td valign="top" align="center">No</td>
    </tr>
  </tbody>
</table>
<p>The <i>fullpath</i> attribute can only be set for filesets that
represent a single file. The <i>prefix</i> and <i>fullpath</i>
attributes cannot both be set on the same fileset.</p>
<p>When using the <i>src</i> attribute, include and exclude patterns
may be used to specify a subset of the archive for inclusion in the
archive as with the <i>dir</i> attribute.</p>

<p>Please note that currently only the <a
href="../Tasks/tar.html">tar</a> and <a
href="../Tasks/zip.html">zip</a> tasks use the permission.</p>

<h3>Parameters specified as nested elements</h3>

<h4>any file system based <a href="resources.html">resource</a> or
single element resource collection</h4>

<p>The specified resource will be used as src.</p>

<h4>Examples</h4>
<blockquote>
  <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>
  <p>zips all files in the <code>htdocs/manual</code> directory into
the <code>docs/user-guide</code> directory in the archive, adds the
file <code>ChangeLog27.txt</code> in the current directory as <code>docs/ChangeLog.txt</code>,
and includes all the html files in <code>examples.zip</code> under <code>docs/examples</code>.
The archive might end up containing the files:</p>
  <code> docs/user-guide/html/index.html<br>
docs/ChangeLog.txt<br>
docs/examples/index.html<br>
  </code></blockquote>


</body>
</html>