2018-12-21 11:20:43 +01:00
|
|
|
<!DOCTYPE html>
|
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
|
|
|
|
|
2019-05-25 13:41:47 +02:00
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
2006-09-11 04:19:00 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
-->
|
2018-12-21 11:20:43 +01:00
|
|
|
<html lang="en">
|
2002-11-06 15:07:23 +00:00
|
|
|
|
|
|
|
<head>
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-11-06 15:07:23 +00:00
|
|
|
<title>Symlink Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="symlink">Symlink</h2>
|
2002-11-06 15:07:23 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Manages symbolic links on platforms where Java supports symbolic links. Can be used to make an
|
|
|
|
individual link, delete a link, create multiple links from properties files, or create properties
|
|
|
|
files describing links in the specified directories. Existing files are not overwritten by
|
|
|
|
default.</p>
|
|
|
|
<p><a href="../Types/fileset.html">FileSet</a>s are used to select a set of links to record, or a
|
|
|
|
set of property files to create links from.</p>
|
2002-11-06 15:07:23 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-11-06 15:07:23 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>action</td>
|
|
|
|
<td>The type of action to perform, may be <q>single</q>, "<q>record</q>, <q>recreate</q>
|
|
|
|
or <q>delete</q>.</td>
|
|
|
|
<td>No; defaults to <q>single</q></td>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>link</td>
|
|
|
|
<td>The name of the link to be created or deleted.<br/><strong>Note</strong>: this attribute is
|
|
|
|
resolved against the current working directory rather than the project's <var>basedir</var>
|
|
|
|
for historical reasons. It is recommended you always use an absolute path or a path
|
|
|
|
like <samp>${basedir}/some-path</samp> as its value.
|
2010-04-16 20:09:48 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Yes, for <var>action</var>=<q>single</q> or <q>delete</q>; ignored in other actions</td>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>resource</td>
|
|
|
|
<td>The resource the link should point to.</td>
|
|
|
|
<td>Yes, for <var>action</var>=<q>single</q>; ignored in other actions</td>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>linkfilename</td>
|
|
|
|
<td>The name of the properties file to create in each included directory.</td>
|
|
|
|
<td>Yes, for <var>action</var>=<q>record</q>; ignored in other actions</td>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>overwrite</td>
|
|
|
|
<td>Overwrite existing files or not. If overwrite is set to <q>true</q>, then any existing file,
|
|
|
|
specified by the link attribute, will be overwritten irrespective of whether or not the
|
|
|
|
existing file is a symbolic link.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>failonerror</td>
|
|
|
|
<td>Stop build if true, log a warning message, but do not stop the build, when the an error
|
2018-03-02 08:23:45 +01:00
|
|
|
occurs if <q>false</q>.</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>true</q></td>
|
2002-11-06 15:07:23 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
2017-12-10 10:22:07 +01:00
|
|
|
|
2002-11-06 15:07:23 +00:00
|
|
|
<h4>fileset</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><a href="../Types/fileset.html">FileSet</a>s are used when <var>action</var>=<q>record</q> to
|
|
|
|
select directories and link names to be recorded. They are also used
|
|
|
|
when <var>action</var>=<q>recreate</q> to specify both the name of the property files to be
|
|
|
|
processed, and the directories in which they can be found. At least one fileset is required for each
|
|
|
|
case.</p>
|
2017-12-10 10:22:07 +01:00
|
|
|
|
2002-11-06 15:07:23 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Make a link named <samp>foo</samp> to a resource named <samp>bar.foo</samp>
|
|
|
|
in <samp>subdir</samp>:</p>
|
|
|
|
<pre><symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/></pre>
|
2017-12-10 10:22:07 +01:00
|
|
|
|
2022-09-16 10:46:01 -05:00
|
|
|
<p>Record all links in <samp>subdir</samp> and its descendants in files
|
2018-02-28 07:58:59 +01:00
|
|
|
named <samp>dir.links</samp></p>
|
|
|
|
<pre>
|
|
|
|
<symlink action="record" linkfilename="dir.links">
|
|
|
|
<fileset dir="${dir.top}" includes="subdir/**"/>
|
|
|
|
</symlink></pre>
|
2017-12-10 10:22:07 +01:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Recreate the links recorded in the previous example:</p>
|
|
|
|
<pre>
|
|
|
|
<symlink action="recreate">
|
|
|
|
<fileset dir="${dir.top}" includes="subdir/**/dir.links"/>
|
|
|
|
</symlink></pre>
|
2017-12-10 10:22:07 +01:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Delete a link named <samp>foo</samp>:</p>
|
|
|
|
<pre><symlink action="delete" link="${dir.top}/foo"/></pre>
|
2002-11-06 15:07:23 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><strong>Java 1.2 and earlier</strong>: Due to limitations on executing system level commands in
|
|
|
|
Java versions earlier than 1.3 this task may have difficulty operating with a relative path
|
2018-03-10 20:17:33 +01:00
|
|
|
in <code>ANT_HOME</code>. The typical symptom is an <code>IOException</code> where Apache Ant can't
|
2018-02-28 07:58:59 +01:00
|
|
|
find <samp>/some/working/directory${ANT_HOME}/bin/antRun</samp> or something similar. The workaround
|
|
|
|
is to change your <code>ANT_HOME</code> environment variable to an absolute path, which will remove
|
|
|
|
the <samp>/some/working/directory</samp> portion of the above path and allow Ant to find the correct
|
|
|
|
command line execution script.</p>
|
2017-12-10 10:22:07 +01:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><strong>Note</strong>: <em>Since Ant 1.10.2</em>, this task relies on the symbolic link support
|
2018-03-10 20:17:33 +01:00
|
|
|
introduced in Java 7 through the <code class="code">java.nio.file.Files</code> APIs</p>
|
2002-11-06 15:07:23 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|