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 4.9 KiB

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