source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/docs/manual/OptionalTasks/symlink.html@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 4.9 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>Symlink Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="symlink">Symlink</a></h2>
12<h3>Description</h3>
13<p> Manages symbolic links on Unix based platforms. Can be used to
14make an individual link, delete a link, create multiple links from properties files,
15or create properties files describing links in the specified directories.
16Existing links are not overwritten by default.
17
18<p><a href="../CoreTypes/fileset.html">FileSet</a>s are used to select a
19set of links to record, or a set of property files to create links from. </p>
20<h3>Parameters</h3>
21<table border="1" cellpadding="2" cellspacing="0">
22 <tr>
23 <td valign="top"><b>Attribute</b></td>
24 <td valign="top"><b>Description</b></td>
25 <td align="center" valign="top"><b>Required</b></td>
26 </tr>
27 <tr>
28 <td valign="top">action</td>
29 <td valign="top">The type of action to perform, may be "single",
30 "record", "recreate" or "delete".</td>
31 <td valign="top" align="center">No, defaults to single.</td>
32 </tr>
33 <tr>
34 <td valign="top">link</td>
35 <td valign="top">The name of the link to be created or deleted.</td>
36 <td valign="center" align="center" >required for
37 action="single" or "delete". Ignored in other actions.</td>
38 </tr>
39 <tr>
40 <td valign="top">resource</td>
41 <td valign="top">The resource the link should point to.</td>
42 <td valign="top" align="center">required for action="single". Ignored in other actions.</td>
43 </tr>
44 <tr>
45 <td valign="top">linkfilename</td>
46 <td valign="top">The name of the properties file to create in
47 each included directory.</td>
48 <td valign="top" align="center">required for action="record".
49 Ignored in other actions.</td>
50 </tr>
51 <tr>
52 <td valign="top">overwrite</td>
53 <td valign="top">Overwrite existing links or not.</td>
54 <td valign="top" align="center">No; defaults to false.</td>
55 </tr>
56 <tr>
57 <td valign="top">failonerror</td>
58 <td valign="top">Stop build if true, log a warning message, but do not stop the build,
59 when the an error occurs if false.
60 </td>
61 <td valign="top" align="center">No; defaults to true.</td>
62 </tr>
63</table>
64<h3>Parameters specified as nested elements</h3>
65
66<h4>fileset</h4>
67 <p><a href="../CoreTypes/fileset.html">FileSet</a>s
68 are used when action = "record" to select directories and linknames to be recorded.
69 They are also used when action = "recreate" to specify both the name of the property
70 files to be processed, and the directories in which they can be found. At least one
71 fileset is required for each case.</p>
72
73<h3>Examples</h3>
74
75 <p> Make a link named "foo" to a resource named "bar.foo" in subdir:</p>
76 <pre>
77 &lt;symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/&gt;
78 </pre>
79
80 <p> Record all links in subdir and it's descendants in files named
81 "dir.links"</p>
82 <pre>
83 &lt;symlink action="record" linkfilename="dir.links"&gt;
84 &lt;fileset dir="${dir.top}" includes="subdir&#47;**"/&gt;
85 &lt;/symlink&gt;
86 </pre>
87
88 <p> Recreate the links recorded in the previous example:</p>
89 <pre>
90 &lt;symlink action="recreate"&gt;
91 &lt;fileset dir="${dir.top}" includes="subdir&#47;**&#47;dir.links"/&gt;
92 &lt;/symlink&gt;
93 </pre>
94
95 <p> Delete a link named "foo":
96 <pre>
97 &lt;symlink action="delete" link="${dir.top}/foo"/&gt;
98 </pre>
99
100 <p><strong>Java 1.2 and earlier:</strong> Due to limitations on executing system
101 level commands in Java versions earlier than 1.3 this task may have difficulty
102 operating with a relative path in ANT_HOME. The typical symptom is an
103 IOException where ant can't find /some/working/directory${ANT_HOME}/bin/antRun
104 or something similar. The workaround is to change your ANT_HOME environment
105 variable to an absolute path, which will remove the /some/working/directory portion
106 of the above path and allow ant to find the correct commandline execution script.
107
108 <p><strong>LIMITATIONS:</strong> Because Java has no direct support for
109 handling symlinks this task divines them by comparing canonical and
110 absolute paths. On non-unix systems this may cause false positives.
111 Furthermore, any operating system on which the command
112 <code>ln -s &lt;linkname&gt; &lt;resourcename&gt;</code> is not a valid
113 command on the command line will not be able to use action="single" or
114 action="recreate". Action="record" and action=delete should still work. Finally,
115 the lack of support for symlinks in Java means that all links are recorded as
116 links to the <strong>canonical</strong> resource name. Therefore the link:
117 <code>link --> subdir/dir/../foo.bar</code> will be recorded as
118 <code>link=subdir/foo.bar</code> and restored as
119 <code>link --> subdir/foo.bar</code></p>
120
121<hr><p align="center">Copyright &copy; 2002,2004 The Apache Software
122Foundation. All rights Reserved.</p>
123
124</body>
125</html>
Note: See TracBrowser for help on using the repository browser.