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 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 | <head>
|
---|
19 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
20 | <title>LoadProperties Task</title>
|
---|
21 | </head>
|
---|
22 |
|
---|
23 | <body>
|
---|
24 |
|
---|
25 |
|
---|
26 | <h2><a name="loadproperties">LoadProperties</a></h2>
|
---|
27 | <h3>Description</h3>
|
---|
28 | <p>
|
---|
29 | Load a file's contents as Ant properties. This is equivalent
|
---|
30 | to <code><property file|resource="..."/></code> except that it
|
---|
31 | supports nested <code><filterchain></code> elements.
|
---|
32 | Also if the file is missing, the build is halted with an error, rather
|
---|
33 | than a warning being printed.
|
---|
34 | </p>
|
---|
35 |
|
---|
36 | <p>If you want to simulate <a href="property.html">property</a>'s
|
---|
37 | prefix attribute, please use <a
|
---|
38 | href="../CoreTypes/filterchain.html#prefixlines">prefixlines</a>
|
---|
39 | filter.</p>
|
---|
40 |
|
---|
41 | <h3>Parameters</h3>
|
---|
42 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
43 | <tr>
|
---|
44 | <td valign="top"><b>Attribute</b></td>
|
---|
45 | <td valign="top"><b>Description</b></td>
|
---|
46 | <td align="center" valign="top"><b>Required</b></td>
|
---|
47 | </tr>
|
---|
48 | <tr>
|
---|
49 | <td valign="top">srcFile</td>
|
---|
50 | <td valign="top">source file</td>
|
---|
51 | <td valign="top" rowspan="2" align="center">One of these or a
|
---|
52 | nested resource</td>
|
---|
53 | </tr>
|
---|
54 | <tr>
|
---|
55 | <td valign="top">resource</td>
|
---|
56 | <td valign="top">the resource name of the property file</td>
|
---|
57 | </tr>
|
---|
58 | <tr>
|
---|
59 | <td valign="top">encoding</td>
|
---|
60 | <td valign="top">encoding to use when loading the file</td>
|
---|
61 | <td align="center" valign="top">No</td>
|
---|
62 | </tr>
|
---|
63 | <tr>
|
---|
64 | <td valign="top">classpath</td>
|
---|
65 | <td valign="top">the classpath to use when looking up a resource.</td>
|
---|
66 | <td align="center" valign="top">No</td>
|
---|
67 | </tr>
|
---|
68 | <tr>
|
---|
69 | <td valign="top">classpathref</td>
|
---|
70 | <td valign="top">the classpath to use when looking up a resource,
|
---|
71 | given as <a href="../using.html#references">reference</a>
|
---|
72 | to a <code><path></code> defined elsewhere..</td>
|
---|
73 | <td align="center" valign="top">No</td>
|
---|
74 | </tr>
|
---|
75 | </table>
|
---|
76 |
|
---|
77 | <h3>Parameters specified as nested elements</h3>
|
---|
78 |
|
---|
79 | <h4>any <a href="../CoreTypes/resources.html">resource</a> or single element
|
---|
80 | resource collection</h4>
|
---|
81 |
|
---|
82 | <p>The specified resource will be used as src. <em>Since Ant 1.7</em></p>
|
---|
83 |
|
---|
84 | <h4><a href="../CoreTypes/filterchain.html">FilterChain</a></h4>
|
---|
85 |
|
---|
86 | <h4>classpath</h4>
|
---|
87 |
|
---|
88 | <p>for use with the <i>resource</i> attribute.</p>
|
---|
89 |
|
---|
90 | <h3>Examples</h3>
|
---|
91 | <pre> <loadproperties srcFile="file.properties"/>
|
---|
92 | </pre>
|
---|
93 | or
|
---|
94 | <pre>
|
---|
95 | <loadproperties>
|
---|
96 | <file file="file.properties"/>
|
---|
97 | </loadproperties>
|
---|
98 | </pre>
|
---|
99 | Load contents of file.properties as Ant properties.
|
---|
100 |
|
---|
101 | <pre> <loadproperties srcFile="file.properties">
|
---|
102 | <filterchain>
|
---|
103 | <<a href="../CoreTypes/filterchain.html#linecontains">linecontains</a>>
|
---|
104 | <contains value="import."/>
|
---|
105 | </linecontains>
|
---|
106 | </filterchain>
|
---|
107 | </loadproperties>
|
---|
108 | </pre>
|
---|
109 | Read the lines that contain the string "import."
|
---|
110 | from the file "file.properties" and load them as
|
---|
111 | Ant properties.
|
---|
112 |
|
---|
113 | <pre>
|
---|
114 | <loadproperties>
|
---|
115 | <<a href="../CoreTypes/resources.html#gzipresource">gzipresource</a>>
|
---|
116 | <<a href="../CoreTypes/resources.html#url">url</a> url="http://example.org/url.properties.gz"/>
|
---|
117 | </gzipresource>
|
---|
118 | </loadproperties>
|
---|
119 | </pre>
|
---|
120 | Load contents of http://example.org/url.properties.gz, uncompress it
|
---|
121 | on the fly and load the contents as Ant properties.
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 | </body>
|
---|
126 | </html>
|
---|
127 |
|
---|