source: release-kits/lirk3/bin/ant-installer/web/manual/manual/CoreTasks/sync.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 4.8 KB
Line 
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
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<html>
18
19<head>
20<meta http-equiv="Content-Language" content="en-us">
21<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
22<title>Sync Task</title>
23</head>
24
25<body>
26
27<h2><a name="get">Sync</a></h2>
28<p><em>Since Ant 1.6</em></p>
29<h3>Description</h3>
30
31<p>Synchronize a target directory from the files defined in one or
32more <a href="../CoreTypes/resources.html#collection">Resource Collection</a>s.</p>
33
34<p>Any file in the target directory that has not been matched by at
35least one of the nested resource collections gets removed. I.e. if you exclude a
36file in your sources and a file of that name is present in the target
37dir, it will get removed from the target.</p>
38
39<h3>Parameters</h3>
40<table border="1" cellpadding="2" cellspacing="0">
41 <tr>
42 <td valign="top"><b>Attribute</b></td>
43 <td valign="top"><b>Description</b></td>
44 <td align="center" valign="top"><b>Required</b></td>
45 </tr>
46 <tr>
47 <td valign="top">todir</td>
48 <td valign="top">the target directory to sync with the resource collections</td>
49 <td align="center" valign="top">Yes</td>
50 </tr>
51 <tr>
52 <td valign="top">overwrite</td>
53 <td valign="top">Overwrite existing files even if the destination
54 files are newer.</td>
55 <td valign="top" align="center">No; defaults to false.</td>
56 </tr>
57 <tr>
58 <td valign="top">includeEmptyDirs</td>
59 <td valign="top">Copy any empty directories included in the resource collection(s).
60 </td>
61 <td valign="top" align="center">No; defaults to true.</td>
62 </tr>
63 <tr>
64 <td valign="top">failonerror</td>
65 <td valign="top">If is set to false, log a warning message, but do not stop the build,
66 when one of the nested filesets points to a directory that
67 doesn't exist.
68 </td>
69 <td valign="top" align="center">No; defaults to true.</td>
70 </tr>
71 <tr>
72 <td valign="top">verbose</td>
73 <td valign="top">Log the files that are being copied.</td>
74 <td valign="top" align="center">No; defaults to false.</td>
75 </tr>
76 <tr>
77 <td valign="top">granularity</td>
78 <td valign="top">The number of milliseconds leeway to give before
79 deciding a file is out of date. This is needed because not every
80 file system supports tracking the last modified time to the
81 millisecond level. Default is 0 milliseconds, or 2 seconds on DOS
82 systems. This can also be useful if source and target files live
83 on separate machines with clocks being out of sync. <em>since Ant
84 1.6.2</em>.</td>
85 <td valign="top" align="center">No.</td>
86 </tr>
87</table>
88
89<h3>Parameters specified as nested elements</h3>
90
91<h4>fileset or any other resource collection</h4>
92<p><a href="../CoreTypes/resources.html#collection">Resource
93Collection</a>s are used to select groups of files to copy. To use a
94resource collection, the <code>todir</code> attribute must be set.</p>
95<p>Prior to Ant 1.7 only <code>&lt;fileset&gt;</code> has been
96supported as a nested element.</p>
97
98<h4>preserveInTarget</h4>
99
100<p>Specifies files or directories that should be kept in the target
101directory even if they are not present in one of the source
102directories.</p>
103
104<p>This nested element is like a <a
105href="../CoreTypes/fileset.html">FileSet</a> except that it doesn't
106support the dir attribute and the usedefaultexcludes attribute
107defaults to false.</p>
108
109<h3>Examples</h3>
110
111<blockquote><pre>
112&lt;sync todir=&quot;site&quot;&gt;
113 &lt;fileset dir=&quot;generated-site&quot;/&gt;
114&lt;/sync&gt;
115</pre></blockquote>
116<p>overwrites all files in <em>site</em> with newer files from
117<em>generated-site</em>, deletes files from <em>site</em> that are not
118present in <em>generated-site</em>.</p>
119
120<blockquote><pre>
121&lt;sync todir=&quot;site&quot;&gt;
122 &lt;fileset dir=&quot;generated-site&quot;/&gt;
123 &lt;preserveintarget&gt;
124 &lt;include name=&quot;**/CVS/**&quot;/&gt;
125 &lt;/preserveintarget&gt;
126&lt;/sync&gt;
127</pre></blockquote>
128<p>overwrites all files in <em>site</em> with newer files from
129<em>generated-site</em>, deletes files from <em>site</em> that are not
130present in <em>generated-site</em> but keeps all files in any
131<em>CVS</em> sub-directory.</p>
132
133
134
135</body>
136</html>
137
Note: See TracBrowser for help on using the repository browser.