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.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 id="symlink">Symlink</h2>
  23. <h3>Description</h3>
  24. <p>
  25. Manages symbolic links on platforms where Java supports symbolic links.
  26. Can be used to make an individual link, delete a link, create multiple links
  27. from properties files, or create properties files describing links in the
  28. specified directories. Existing files are not overwritten by default.
  29. </p>
  30. <p>
  31. <a href="../Types/fileset.html">FileSet</a>s are used to select a
  32. set of links to record, or a set of property files to create links from.
  33. </p>
  34. <h3>Parameters</h3>
  35. <table>
  36. <tr>
  37. <td valign="top"><b>Attribute</b></td>
  38. <td valign="top"><b>Description</b></td>
  39. <td align="center" valign="top"><b>Required</b></td>
  40. </tr>
  41. <tr>
  42. <td valign="top">action</td>
  43. <td valign="top">The type of action to perform, may be "single",
  44. "record", "recreate" or "delete".</td>
  45. <td valign="top" align="center">No, defaults to single.</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">link</td>
  49. <td valign="top">The name of the link to be created or deleted.<br/>
  50. <strong>Note</strong>: this attribute is resolved against the current
  51. working directory rather than the project's basedir for
  52. historical reasons. It is recommended you always use an
  53. absolute path or a path like <code>${basedir}/some-path</code>
  54. as its value.
  55. </td>
  56. <td valign="center" align="center" >required for
  57. action="single" or "delete". Ignored in other actions.</td>
  58. </tr>
  59. <tr>
  60. <td valign="top">resource</td>
  61. <td valign="top">The resource the link should point to.</td>
  62. <td valign="top" align="center">required for action="single". Ignored in other actions.</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">linkfilename</td>
  66. <td valign="top">The name of the properties file to create in
  67. each included directory.</td>
  68. <td valign="top" align="center">required for action="record".
  69. Ignored in other actions.</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">overwrite</td>
  73. <td valign="top">Overwrite existing files or not. If overwrite is set to true, then
  74. any existing file, specified by the link attribute, will be overwritten irrespective
  75. of whether or not the existing file is a symbolic link.</td>
  76. <td valign="top" align="center">No; defaults to false.</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">failonerror</td>
  80. <td valign="top">Stop build if true, log a warning message, but do not stop the build,
  81. when the an error occurs if false.
  82. </td>
  83. <td valign="top" align="center">No; defaults to true.</td>
  84. </tr>
  85. </table>
  86. <h3>Parameters specified as nested elements</h3>
  87. <h4>fileset</h4>
  88. <p><a href="../Types/fileset.html">FileSet</a>s
  89. are used when action = "record" to select directories and linknames to be recorded.
  90. They are also used when action = "recreate" to specify both the name of the property
  91. files to be processed, and the directories in which they can be found. At least one
  92. fileset is required for each case.</p>
  93. <h3>Examples</h3>
  94. <p>Make a link named "foo" to a resource named "bar.foo" in subdir:</p>
  95. <pre>
  96. &lt;symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/&gt;
  97. </pre>
  98. <p>Record all links in subdir and it's descendants in files named
  99. "dir.links"</p>
  100. <pre>
  101. &lt;symlink action="record" linkfilename="dir.links"&gt;
  102. &lt;fileset dir="${dir.top}" includes="subdir&#47;**"/&gt;
  103. &lt;/symlink&gt;
  104. </pre>
  105. <p>Recreate the links recorded in the previous example:</p>
  106. <pre>
  107. &lt;symlink action="recreate"&gt;
  108. &lt;fileset dir="${dir.top}" includes="subdir&#47;**&#47;dir.links"/&gt;
  109. &lt;/symlink&gt;
  110. </pre>
  111. <p>Delete a link named "foo":</p>
  112. <pre>
  113. &lt;symlink action="delete" link="${dir.top}/foo"/&gt;
  114. </pre>
  115. <p><strong>Java 1.2 and earlier</strong>: Due to limitations on executing system
  116. level commands in Java versions earlier than 1.3 this task may have difficulty
  117. operating with a relative path in ANT_HOME. The typical symptom is an
  118. IOException where Apache Ant can't find /some/working/directory${ANT_HOME}/bin/antRun
  119. or something similar. The workaround is to change your ANT_HOME environment
  120. variable to an absolute path, which will remove the /some/working/directory portion
  121. of the above path and allow Ant to find the correct commandline execution script.
  122. <p><strong>Note</strong>: <em>Since Ant 1.10.2</em>, this task relies on the symbolic
  123. link support introduced in Java 7 through the java.nio.file.Files APIs</p>
  124. </body>
  125. </html>