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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE html>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. https://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <html lang="en">
  17. <head>
  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>Manages symbolic links on platforms where Java supports symbolic links. Can be used to make an
  25. individual link, delete a link, create multiple links from properties files, or create properties
  26. files describing links in the specified directories. Existing files are not overwritten by
  27. default.</p>
  28. <p><a href="../Types/fileset.html">FileSet</a>s are used to select a set of links to record, or a
  29. set of property files to create links from.</p>
  30. <h3>Parameters</h3>
  31. <table class="attr">
  32. <tr>
  33. <th scope="col">Attribute</th>
  34. <th scope="col">Description</th>
  35. <th scope="col">Required</th>
  36. </tr>
  37. <tr>
  38. <td>action</td>
  39. <td>The type of action to perform, may be <q>single</q>, "<q>record</q>, <q>recreate</q>
  40. or <q>delete</q>.</td>
  41. <td>No; defaults to <q>single</q></td>
  42. </tr>
  43. <tr>
  44. <td>link</td>
  45. <td>The name of the link to be created or deleted.<br/><strong>Note</strong>: this attribute is
  46. resolved against the current working directory rather than the project's <var>basedir</var>
  47. for historical reasons. It is recommended you always use an absolute path or a path
  48. like <samp>${basedir}/some-path</samp> as its value.
  49. </td>
  50. <td>Yes, for <var>action</var>=<q>single</q> or <q>delete</q>; ignored in other actions</td>
  51. </tr>
  52. <tr>
  53. <td>resource</td>
  54. <td>The resource the link should point to.</td>
  55. <td>Yes, for <var>action</var>=<q>single</q>; ignored in other actions</td>
  56. </tr>
  57. <tr>
  58. <td>linkfilename</td>
  59. <td>The name of the properties file to create in each included directory.</td>
  60. <td>Yes, for <var>action</var>=<q>record</q>; ignored in other actions</td>
  61. </tr>
  62. <tr>
  63. <td>overwrite</td>
  64. <td>Overwrite existing files or not. If overwrite is set to <q>true</q>, then any existing file,
  65. specified by the link attribute, will be overwritten irrespective of whether or not the
  66. existing file is a symbolic link.</td>
  67. <td>No; defaults to <q>false</q></td>
  68. </tr>
  69. <tr>
  70. <td>failonerror</td>
  71. <td>Stop build if true, log a warning message, but do not stop the build, when the an error
  72. occurs if <q>false</q>.</td>
  73. <td>No; defaults to <q>true</q></td>
  74. </tr>
  75. </table>
  76. <h3>Parameters specified as nested elements</h3>
  77. <h4>fileset</h4>
  78. <p><a href="../Types/fileset.html">FileSet</a>s are used when <var>action</var>=<q>record</q> to
  79. select directories and link names to be recorded. They are also used
  80. when <var>action</var>=<q>recreate</q> to specify both the name of the property files to be
  81. processed, and the directories in which they can be found. At least one fileset is required for each
  82. case.</p>
  83. <h3>Examples</h3>
  84. <p>Make a link named <samp>foo</samp> to a resource named <samp>bar.foo</samp>
  85. in <samp>subdir</samp>:</p>
  86. <pre>&lt;symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/&gt;</pre>
  87. <p>Record all links in <samp>subdir</samp> and it's descendants in files
  88. named <samp>dir.links</samp></p>
  89. <pre>
  90. &lt;symlink action="record" linkfilename="dir.links"&gt;
  91. &lt;fileset dir="${dir.top}" includes="subdir/**"/&gt;
  92. &lt;/symlink&gt;</pre>
  93. <p>Recreate the links recorded in the previous example:</p>
  94. <pre>
  95. &lt;symlink action="recreate"&gt;
  96. &lt;fileset dir="${dir.top}" includes="subdir/**/dir.links"/&gt;
  97. &lt;/symlink&gt;</pre>
  98. <p>Delete a link named <samp>foo</samp>:</p>
  99. <pre>&lt;symlink action="delete" link="${dir.top}/foo"/&gt;</pre>
  100. <p><strong>Java 1.2 and earlier</strong>: Due to limitations on executing system level commands in
  101. Java versions earlier than 1.3 this task may have difficulty operating with a relative path
  102. in <code>ANT_HOME</code>. The typical symptom is an <code>IOException</code> where Apache Ant can't
  103. find <samp>/some/working/directory${ANT_HOME}/bin/antRun</samp> or something similar. The workaround
  104. is to change your <code>ANT_HOME</code> environment variable to an absolute path, which will remove
  105. the <samp>/some/working/directory</samp> portion of the above path and allow Ant to find the correct
  106. command line execution script.</p>
  107. <p><strong>Note</strong>: <em>Since Ant 1.10.2</em>, this task relies on the symbolic link support
  108. introduced in Java 7 through the <code class="code">java.nio.file.Files</code> APIs</p>
  109. </body>
  110. </html>