2018-12-21 11:20:43 +01:00
|
|
|
<!DOCTYPE html>
|
2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
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
|
|
|
|
|
2019-05-25 13:41:47 +02:00
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
2006-09-11 04:19:00 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
-->
|
2018-12-21 11:20:43 +01:00
|
|
|
<html lang="en">
|
2002-03-06 03:25:51 +00:00
|
|
|
<head>
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-03-06 03:25:51 +00:00
|
|
|
<title>LoadProperties Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="loadproperties">LoadProperties</h2>
|
2002-03-06 03:25:51 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Load a file's contents as Apache Ant properties. This is equivalent to <code><property
|
|
|
|
file|resource=<q>...</q>/></code> except that it supports nested <code><filterchain></code>
|
|
|
|
elements. Also if the file is missing, the build is halted with an error, rather than a warning
|
|
|
|
being printed.</p>
|
|
|
|
|
|
|
|
<p><strong>Note</strong>: the default value of this task's <var>prefixValues</var> attribute is
|
|
|
|
different from the default value of the same attribute in
|
|
|
|
the <a href="property.html"><code><property></code></a> task.</p>
|
2003-03-19 08:54:08 +00:00
|
|
|
|
2002-03-06 03:25:51 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-03-06 03:25:51 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-03-06 03:25:51 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>srcFile</td>
|
|
|
|
<td>source file</td>
|
|
|
|
<td rowspan="2">One of these or a nested resource</td>
|
2004-04-20 19:29:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>resource</td>
|
|
|
|
<td class="left">the resource name of the property file</td>
|
2002-03-06 03:25:51 +00:00
|
|
|
</tr>
|
2002-07-19 17:48:36 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>encoding</td>
|
|
|
|
<td>encoding to use when loading the file</td>
|
|
|
|
<td>No</td>
|
2002-07-19 17:48:36 +00:00
|
|
|
</tr>
|
2004-04-20 19:29:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classpath</td>
|
|
|
|
<td>the classpath to use when looking up a resource.</td>
|
|
|
|
<td>No</td>
|
2004-04-20 19:29:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classpathref</td>
|
|
|
|
<td>the classpath to use when looking up a resource, given
|
|
|
|
as <a href="../using.html#references">reference</a> to a <code><path></code> defined
|
|
|
|
elsewhere.</td>
|
|
|
|
<td>No</td>
|
2004-04-20 19:29:56 +00:00
|
|
|
</tr>
|
2010-02-25 00:06:04 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>prefix</td>
|
|
|
|
<td>Prefix to apply to loaded properties. <em>Since Ant 1.8.1</em></td>
|
|
|
|
<td>No; default is <q>.</q></td>
|
2010-02-25 00:06:04 +00:00
|
|
|
</tr>
|
2010-06-29 16:16:41 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>prefixValues</td>
|
|
|
|
<td>Whether to apply the prefix when expanding the right hand side of the properties. <em>Since
|
|
|
|
Ant 1.8.2</em></td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2010-06-29 16:16:41 +00:00
|
|
|
</tr>
|
2002-03-06 03:25:51 +00:00
|
|
|
</table>
|
2005-11-29 04:41:31 +00:00
|
|
|
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
2010-05-26 20:33:51 +00:00
|
|
|
<h4>any <a href="../Types/resources.html">resource</a> or single element
|
2005-11-29 04:41:31 +00:00
|
|
|
resource collection</h4>
|
|
|
|
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7</em></p>
|
|
|
|
|
|
|
|
<p>The specified resource will be used as <var>srcFile</var> or <var>resource</var>.</p>
|
2005-11-29 04:41:31 +00:00
|
|
|
|
2010-05-26 20:33:51 +00:00
|
|
|
<h4><a href="../Types/filterchain.html">FilterChain</a></h4>
|
2005-11-29 04:41:31 +00:00
|
|
|
|
|
|
|
<h4>classpath</h4>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>for use with the <var>resource</var> attribute.</p>
|
2002-03-06 03:25:51 +00:00
|
|
|
|
|
|
|
<h3>Examples</h3>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>Load contents of <samp>file.properties</samp> as Ant properties.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><loadproperties srcFile="file.properties"/></pre>
|
|
|
|
<p>or</p>
|
|
|
|
<pre>
|
|
|
|
<loadproperties>
|
|
|
|
<file file="file.properties"/>
|
|
|
|
</loadproperties></pre>
|
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Read the lines that contain the string <q>import.</q> from the file <samp>file.properties</samp>
|
|
|
|
and load them as Ant properties.</p>
|
2005-11-29 04:41:31 +00:00
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<loadproperties srcFile="file.properties">
|
|
|
|
<filterchain>
|
2010-05-26 20:33:51 +00:00
|
|
|
<<a href="../Types/filterchain.html#linecontains">linecontains</a>>
|
2018-02-28 07:58:59 +01:00
|
|
|
<contains value="import."/>
|
2002-09-23 11:06:53 +00:00
|
|
|
</linecontains>
|
2018-02-28 07:58:59 +01:00
|
|
|
</filterchain>
|
|
|
|
</loadproperties></pre>
|
2005-11-29 04:41:31 +00:00
|
|
|
|
2019-05-25 15:38:31 +02:00
|
|
|
<p>Load contents of <samp>https://example.org/url.properties.gz</samp>, uncompress it on the fly and
|
2018-05-15 09:51:58 +02:00
|
|
|
load the contents as Ant properties.</p>
|
2005-11-29 04:41:31 +00:00
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<loadproperties>
|
|
|
|
<<a href="../Types/resources.html#gzipresource">gzipresource</a>>
|
2019-05-25 15:38:31 +02:00
|
|
|
<<a href="../Types/resources.html#url">url</a> url="https://example.org/url.properties.gz"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</gzipresource>
|
|
|
|
</loadproperties></pre>
|
2005-11-29 04:41:31 +00:00
|
|
|
|
2002-03-06 03:25:51 +00:00
|
|
|
</body>
|
|
|
|
</html>
|