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>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="get">Sync</h2>
|
2010-11-11 17:04:16 +00:00
|
|
|
<p><em>Since Apache Ant 1.6</em></p>
|
2003-05-14 11:52:08 +00:00
|
|
|
<h3>Description</h3>
|
|
|
|
|
|
|
|
<p>Synchronize a target directory from the files defined in one or
|
2018-03-05 17:35:30 +01:00
|
|
|
more <a href="../Types/resources.html#collection">resource collections</a>.</p>
|
2003-05-14 11:52:08 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Any file in the target directory that has not been matched by at least one of the nested resource
|
|
|
|
collections gets removed. I.e. if you exclude a file in your sources and a file of that name is
|
|
|
|
present in the target dir, it will get removed from the target.</p>
|
2005-03-15 15:07:15 +00:00
|
|
|
|
2003-05-14 11:52:08 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2003-05-14 11:52:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2003-05-14 11:52:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>todir</td>
|
|
|
|
<td>the target directory to sync with the resource collections</td>
|
|
|
|
<td>Yes</td>
|
2018-01-22 23:52:21 +01:00
|
|
|
</tr>
|
2003-05-14 11:52:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>overwrite</td>
|
|
|
|
<td>Overwrite existing files even if the destination files are newer.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-05-14 11:52:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>includeEmptyDirs</td>
|
|
|
|
<td>Copy any empty directories included in the resource
|
|
|
|
collection(s).<br/><strong>Note</strong>: this attribute also controls the behavior for any
|
2018-03-11 14:17:46 +01:00
|
|
|
nested <code><preserveintarget></code> element. If this attribute is <q>false</q> (the
|
|
|
|
default) empty directories that only exist in the target directory will be removed even if
|
|
|
|
they are matched by the patterns of <code><preserveintarget></code>. This can be
|
|
|
|
overridden by <code><preserveintarget></code>'s <var>preserveEmptyDirs</var>
|
|
|
|
attribute.</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-05-14 11:52:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>failonerror</td>
|
|
|
|
<td>If set to <q>false</q>, log a warning message, but do not stop the build, when one of the
|
|
|
|
nested filesets points to a directory that doesn't exist.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2003-05-14 11:52:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>verbose</td>
|
|
|
|
<td>Log the files that are being copied.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2003-05-14 11:52:08 +00:00
|
|
|
</tr>
|
2003-09-23 13:16:04 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>granularity</td>
|
|
|
|
<td>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. This can also be useful if source and target files live on separate
|
|
|
|
machines with clocks being out of sync. <em>since Ant 1.6.2</em>.</td>
|
|
|
|
<td>No; default is 0 milliseconds, or 2 seconds on DOS systems.</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>
|
|
|
|
|
2018-03-05 17:35:30 +01:00
|
|
|
<h4>any resource collection</h4>
|
|
|
|
<p><a href="../Types/resources.html#collection">resource collections</a> are used to select groups
|
2018-02-28 07:58:59 +01:00
|
|
|
of files to copy.</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>
|
|
|
|
|
2018-02-28 07:58:59 +01: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>
|
2005-03-14 09:33:30 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This nested element is like a <a href="../Types/fileset.html">FileSet</a> except that it doesn't
|
|
|
|
support the <var>dir</var> attribute and the <var>usedefaultexcludes</var> attribute defaults
|
|
|
|
to <q>false</q>.</p>
|
2005-03-14 09:33:30 +00:00
|
|
|
|
2018-03-05 21:01:42 +01:00
|
|
|
<h5>Additional parameters</h5>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2008-12-18 15:42:27 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2008-12-18 15:42:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>preserveEmptyDirs</td>
|
|
|
|
<td>Overrules the <var>includeEmptydirs</var> 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 <var>includeemptydirs</var> attribute or this one. If the two attribute values
|
|
|
|
conflict, this attribute "wins".</td>
|
|
|
|
<td>No; defaults to the value of the task's <var>includeemptydirs</var> attribute</td>
|
2018-01-22 23:52:21 +01:00
|
|
|
</tr>
|
2008-12-18 15:42:27 +00:00
|
|
|
</table>
|
|
|
|
|
2005-03-14 09:33:30 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2005-03-14 09:33:30 +00:00
|
|
|
<sync todir="site">
|
|
|
|
<fileset dir="generated-site"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</sync></pre>
|
|
|
|
<p>overwrites all files in <samp>site</samp> with newer files from <samp>generated-site</samp>,
|
|
|
|
deletes files from <samp>site</samp> that are not present in <samp>generated-site</samp>.</p>
|
2005-03-14 09:33:30 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2005-03-14 09:33:30 +00:00
|
|
|
<sync todir="site">
|
|
|
|
<fileset dir="generated-site"/>
|
|
|
|
<preserveintarget>
|
|
|
|
<include name="**/CVS/**"/>
|
|
|
|
</preserveintarget>
|
2018-02-28 07:58:59 +01:00
|
|
|
</sync></pre>
|
|
|
|
<p>overwrites all files in <samp>site</samp> with newer files from <samp>generated-site</samp>,
|
|
|
|
deletes files from <samp>site</samp> that are not present in <samp>generated-site</samp> but keeps
|
|
|
|
all files in any <samp>CVS</samp> sub-directory.</p>
|
2005-03-14 09:33:30 +00:00
|
|
|
|
2003-05-14 11:52:08 +00:00
|
|
|
</body>
|
|
|
|
</html>
|