You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

symlink.html 5.8 KiB

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