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.

tempfile.html 2.8 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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>Tempfile Task</title>
  20. </head>
  21. <body>
  22. <h2>Tempfile Task</h2>
  23. <h3 id="description">Description</h3>
  24. <p>This task sets a property to the name of a temporary file.
  25. Unlike <code class="code">java.io.File.createTempFile</code>, this task does not actually create the
  26. temporary file, but it does guarantee that the file did not exist when the task was executed.</p>
  27. <h3 id="attributes">Parameters</h3>
  28. <table class="attr">
  29. <tr>
  30. <th scope="col">Attribute</th>
  31. <th scope="col">Description</th>
  32. <th scope="col">Type</th>
  33. <th scope="col">Required</th>
  34. </tr>
  35. <tr>
  36. <td>property</td>
  37. <td>Sets the property you wish to assign the temporary file to.</td>
  38. <td>String</td>
  39. <td>Yes</td>
  40. </tr>
  41. <tr>
  42. <td>destdir</td>
  43. <td>Sets the destination directory.</td>
  44. <td>File</td>
  45. <td>No; defaults to <var>basedir</var></td>
  46. </tr>
  47. <tr>
  48. <td>prefix</td>
  49. <td>Sets the optional prefix string for the temp file.</td>
  50. <td>String</td>
  51. <td>No</td>
  52. </tr>
  53. <tr>
  54. <td>suffix</td>
  55. <td>Sets the optional suffix string for the temp file.</td>
  56. <td>String</td>
  57. <td>No</td>
  58. </tr>
  59. <tr>
  60. <td>deleteonexit</td>
  61. <td>Whether the temp file will be marked for deletion on normal exit of JVM (even though the
  62. file may never be created). <em>Since Apache Ant 1.7</em></td>
  63. <td>boolean</td>
  64. <td>No; defaults to <q>false</q></td>
  65. </tr>
  66. <tr>
  67. <td>createfile</td>
  68. <td>Whether the temp file should be created by this task. <em>Since Ant 1.8</em></td>
  69. <td>boolean</td>
  70. <td>No; defaults to <q>false</q></td>
  71. </tr>
  72. </table>
  73. <h3>Examples</h3>
  74. <p>Create a temporary file</p>
  75. <pre>&lt;tempfile property="temp.file"/&gt;</pre>
  76. <p>Create a temporary file with the <code>.xml</code> suffix</p>
  77. <pre>&lt;tempfile property="temp.file" suffix=".xml"/&gt;</pre>
  78. <p>Create a temporary file in the <code>build</code> subdirectory</p>
  79. <pre>&lt;tempfile property="temp.file" destDir="build"/&gt;</pre>
  80. </body>
  81. </html>