blob: e1c930a03ec0fdb0d081b39beb7512df12f93e99 [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
<title>Tempfile Task</title>
</head>
<body>
<h2>Tempfile Task</h2>
<h3 id="description">Description</h3>
This task sets a property to the name of a temporary file.
Unlike <code>java.io.File.createTempFile</code>,
this task does not actually create the temporary file, but it does guarantee that the
file did not exist when the task was executed.
<h3>Examples:</h3>
<pre>&lt;tempfile property="temp.file"/&gt;</pre>
create a temporary file
<pre>&lt;tempfile property="temp.file" suffix=".xml"/&gt;</pre>
create a temporary file with the <code>.xml</code> suffix
<pre>&lt;tempfile property="temp.file" destDir="build"/&gt;</pre>
create a temporary file in the <code>build</code> subdirectory
<h3 id="attributes">Parameters</h3>
<table>
<tr>
<td valign="top" align="left">
<b>Attribute</b>
</td>
<td valign="top" align="left">
<b>Description</b>
</td>
<td valign="top" align="left">
<b>Type</b>
</td>
<td valign="top" align="left">
<b>Requirement</b>
</td>
</tr>
<tr>
<td valign="top" align="left">
property
</td>
<td valign="top" align="left">
Sets the property you wish to assign the temporary file to.
</td>
<td valign="top" align="left">
String
</td>
<td valign="top" align="left" rowspan="1">
Required
</td>
</tr>
<tr>
<td valign="top" align="left">
destdir
</td>
<td valign="top" align="left">
Sets the destination directory. If not set, the basedir directory is used instead.
</td>
<td valign="top" align="left">
File
</td>
<td valign="top" align="left" rowspan="5">
Optional
</td>
</tr>
<tr>
<td valign="top" align="left">
prefix
</td>
<td valign="top" align="left">
Sets the optional prefix string for the temp file.
</td>
<td valign="top" align="left">
String
</td>
</tr>
<tr>
<td valign="top" align="left">
suffix
</td>
<td valign="top" align="left">
Sets the optional suffix string for the temp file.
</td>
<td valign="top" align="left">
String
</td>
</tr>
<tr>
<td valign="top" align="left">
deleteonexit
</td>
<td valign="top" align="left">
Whether the temp file will be marked for deletion on normal exit of the Java Virtual Machine (even though the file may never be created); default <em>false</em>. <em>Since Apache Ant 1.7</em>
</td>
<td valign="top" align="left">
boolean
</td>
</tr>
<tr>
<td valign="top" align="left">
createfile
</td>
<td valign="top" align="left">
Whether the temp file should be created by this task; default <em>false</em>. <em>Since Ant 1.8</em>
</td>
<td valign="top" align="left">
boolean
</td>
</tr>
</table>
</body>
</html>