2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
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.
|
|
|
|
-->
|
2003-05-14 11:52:08 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2003-05-14 11:52:08 +00:00
|
|
|
<title>Sync Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="get">Sync</a></h2>
|
|
|
|
<p><em>Since Ant 1.6</em></p>
|
|
|
|
<h3>Description</h3>
|
|
|
|
|
|
|
|
<p>Synchronize a target directory from the files defined in one or
|
2010-05-26 20:33:51 +00:00
|
|
|
more <a href="../Types/resources.html#collection">Resource Collection</a>s.</p>
|
2003-05-14 11:52:08 +00:00
|
|
|
|
2005-03-15 15:07:15 +00:00
|
|
|
<p>Any file in the target directory that has not been matched by at
|
2005-10-06 03:51:48 +00:00
|
|
|
least one of the nested resource collections gets removed. I.e. if you exclude a
|
2005-03-15 15:07:15 +00:00
|
|
|
file in your sources and a file of that name is present in the target
|
|
|
|
dir, it will get removed from the target.</p>
|
|
|
|
|
2003-05-14 11:52:08 +00:00
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">todir</td>
|
2005-09-28 18:42:46 +00:00
|
|
|
<td valign="top">the target directory to sync with the resource collections</td>
|
2003-05-14 11:52:08 +00:00
|
|
|
<td align="center" valign="top">Yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">overwrite</td>
|
|
|
|
<td valign="top">Overwrite existing files even if the destination
|
|
|
|
files are newer.</td>
|
|
|
|
<td valign="top" align="center">No; defaults to false.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">includeEmptyDirs</td>
|
2008-12-05 05:07:09 +00:00
|
|
|
<td valign="top">Copy any empty directories included in the
|
|
|
|
resource collection(s).<br/>
|
|
|
|
<b>Note</b> this attribute also controls the behavior for any
|
|
|
|
nested <preserveintarget> element. If this attribute is
|
|
|
|
false (the default) empty directories that only exist in the
|
|
|
|
target directory will be removed even if they are matched by
|
2008-12-18 15:42:27 +00:00
|
|
|
the patterns of <preserveintarget>. This can be
|
|
|
|
overridden by <preserveintarget>'s
|
|
|
|
preserveEmptyDirs attribute.
|
2003-05-14 11:52:08 +00:00
|
|
|
</td>
|
2006-12-15 12:39:18 +00:00
|
|
|
<td valign="top" align="center">No; defaults to false.</td>
|
2003-05-14 11:52:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">failonerror</td>
|
2006-09-10 20:42:25 +00:00
|
|
|
<td valign="top">If is set to false, log a warning message, but do not stop the build,
|
2003-05-14 11:52:08 +00:00
|
|
|
when one of the nested filesets points to a directory that
|
|
|
|
doesn't exist.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No; defaults to true.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">verbose</td>
|
|
|
|
<td valign="top">Log the files that are being copied.</td>
|
|
|
|
<td valign="top" align="center">No; defaults to false.</td>
|
|
|
|
</tr>
|
2003-09-23 13:16:04 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">granularity</td>
|
|
|
|
<td valign="top">The number of milliseconds leeway to give before
|
|
|
|
deciding a file is out of date. This is needed because not every
|
|
|
|
file system supports tracking the last modified time to the
|
|
|
|
millisecond level. Default is 0 milliseconds, or 2 seconds on DOS
|
|
|
|
systems. This can also be useful if source and target files live
|
|
|
|
on separate machines with clocks being out of sync. <em>since Ant
|
2005-05-11 19:03:45 +00:00
|
|
|
1.6.2</em>.</td>
|
2005-03-14 09:33:30 +00:00
|
|
|
<td valign="top" align="center">No.</td>
|
2003-09-23 13:16:04 +00:00
|
|
|
</tr>
|
2003-05-14 11:52:08 +00:00
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
2005-10-06 03:51:48 +00:00
|
|
|
<h4>fileset or any other resource collection</h4>
|
2010-05-26 20:33:51 +00:00
|
|
|
<p><a href="../Types/resources.html#collection">Resource
|
2005-09-28 18:42:46 +00:00
|
|
|
Collection</a>s are used to select groups of files to copy. To use a
|
|
|
|
resource collection, the <code>todir</code> attribute must be set.</p>
|
|
|
|
<p>Prior to Ant 1.7 only <code><fileset></code> has been
|
|
|
|
supported as a nested element.</p>
|
2003-05-14 11:52:08 +00:00
|
|
|
|
2005-03-14 09:33:30 +00:00
|
|
|
<h4>preserveInTarget</h4>
|
|
|
|
|
2009-04-09 13:59:45 +00:00
|
|
|
<p><em>Since Ant 1.7.0</em></p>
|
|
|
|
|
2005-03-14 09:33:30 +00:00
|
|
|
<p>Specifies files or directories that should be kept in the target
|
|
|
|
directory even if they are not present in one of the source
|
|
|
|
directories.</p>
|
|
|
|
|
|
|
|
<p>This nested element is like a <a
|
2010-05-26 20:33:51 +00:00
|
|
|
href="../Types/fileset.html">FileSet</a> except that it doesn't
|
2005-03-14 09:33:30 +00:00
|
|
|
support the dir attribute and the usedefaultexcludes attribute
|
|
|
|
defaults to false.</p>
|
|
|
|
|
2008-12-18 15:42:27 +00:00
|
|
|
<h5>Additional Parameters</h5>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">preserveEmptyDirs</td>
|
|
|
|
<td valign="top">Overrules the includeEmptydirs setting for
|
|
|
|
directories matched by this element. If you want to preserve
|
|
|
|
empty directories that are not in your source directory you can
|
|
|
|
either set the task's includeemptydirs attribute or this one.
|
|
|
|
If the two attribute values conflict, this attribute
|
|
|
|
"wins".</td>
|
|
|
|
<td align="center" valign="top">No, defaults to the value of the
|
|
|
|
task's includeemptydirs attribute</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2005-03-14 09:33:30 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
|
|
|
|
<blockquote><pre>
|
|
|
|
<sync todir="site">
|
|
|
|
<fileset dir="generated-site"/>
|
|
|
|
</sync>
|
|
|
|
</pre></blockquote>
|
|
|
|
<p>overwrites all files in <em>site</em> with newer files from
|
|
|
|
<em>generated-site</em>, deletes files from <em>site</em> that are not
|
|
|
|
present in <em>generated-site</em>.</p>
|
|
|
|
|
|
|
|
<blockquote><pre>
|
|
|
|
<sync todir="site">
|
|
|
|
<fileset dir="generated-site"/>
|
|
|
|
<preserveintarget>
|
|
|
|
<include name="**/CVS/**"/>
|
|
|
|
</preserveintarget>
|
|
|
|
</sync>
|
|
|
|
</pre></blockquote>
|
|
|
|
<p>overwrites all files in <em>site</em> with newer files from
|
|
|
|
<em>generated-site</em>, deletes files from <em>site</em> that are not
|
|
|
|
present in <em>generated-site</em> but keeps all files in any
|
|
|
|
<em>CVS</em> sub-directory.</p>
|
|
|
|
|
2006-09-11 04:33:25 +00:00
|
|
|
|
2003-05-14 11:52:08 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|