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 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>Echoproperties Task</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="echoproperties">echoproperties</a></h2>
|
---|
28 | <h3>Description</h3>
|
---|
29 |
|
---|
30 | <p>Displays all the current properties (or a subset of them specified
|
---|
31 | by a nested <code><propertyset></code>) in the project. The
|
---|
32 | output can be sent to a file if desired. This task can be used as a
|
---|
33 | somewhat contrived means of returning data from an
|
---|
34 | <tt><ant></tt> invocation, but is really for debugging build
|
---|
35 | files.</p>
|
---|
36 |
|
---|
37 | <h3>Parameters</h3>
|
---|
38 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
39 | <tr>
|
---|
40 | <td valign="top"><b>Attribute</b></td>
|
---|
41 | <td valign="top"><b>Description</b></td>
|
---|
42 | <td align="center" valign="top"><b>Required</b></td>
|
---|
43 | </tr>
|
---|
44 | <tr>
|
---|
45 | <td valign="top">destfile</td>
|
---|
46 | <td valign="top">If specified, the value indicates the name of the
|
---|
47 | file to send the output of the statement to. The generated output file
|
---|
48 | is compatible for loading by any Java application as a property file.
|
---|
49 | If not specified, then the output will go to the Ant log.</td>
|
---|
50 | <td valign="top" align="center">No</td>
|
---|
51 | </tr>
|
---|
52 | <tr>
|
---|
53 | <td valign="top">prefix</td>
|
---|
54 | <td valign="top">
|
---|
55 | a prefix which is used to filter the properties
|
---|
56 | only those properties starting with this prefix will be echoed.
|
---|
57 | <P>
|
---|
58 | </td>
|
---|
59 | <td valign="top" align="center">No</td>
|
---|
60 | </tr>
|
---|
61 | <tr>
|
---|
62 | <td valign="top">regex</td>
|
---|
63 | <td valign="top">
|
---|
64 | a regular expression which is used to filter the
|
---|
65 | properties
|
---|
66 | only those properties whose names match it will be echoed.
|
---|
67 | </td>
|
---|
68 | <td valign="top" align="center">No</td>
|
---|
69 | </tr>
|
---|
70 | <tr>
|
---|
71 | <td valign="top">failonerror</td>
|
---|
72 | <td valign="top">By default, the "failonerror" attribute is enabled.
|
---|
73 | If an error occurs while writing the properties to a file, and this
|
---|
74 | attribute is enabled, then a BuildException will be thrown, causing the
|
---|
75 | build to fail. If disabled, then IO errors will be reported as a log
|
---|
76 | statement, and the build will continue without failure from this task.</td>
|
---|
77 | <td valign="top" align="center">No</td>
|
---|
78 | </tr>
|
---|
79 | <tr>
|
---|
80 | <td valign="top">format</td>
|
---|
81 | <td valign="top">One of <code>text</code> or <code>xml</code>.
|
---|
82 | Determines the output format. Defaults to <code>text</code>.</td>
|
---|
83 | <td valign="top" align="center">No</td>
|
---|
84 | </tr>
|
---|
85 | </table>
|
---|
86 |
|
---|
87 | <h3>Parameters specified as nested elements</h3>
|
---|
88 |
|
---|
89 | <h4>propertyset</h4>
|
---|
90 |
|
---|
91 | <p>You can specify subsets of properties to be echoed with <a
|
---|
92 | href="../CoreTypes/propertyset.html">propertyset</a>s. Using
|
---|
93 | <tt>propertyset</tt>s gives more control on which properties will be
|
---|
94 | picked up. The attributes <tt>prefix</tt> and <tt>regex</tt> are just
|
---|
95 | shorcuts that use <tt>propertyset</tt>s internally.
|
---|
96 | </p>
|
---|
97 |
|
---|
98 | <p><em>since Ant 1.6</em>.</p>
|
---|
99 |
|
---|
100 | <h3>Examples</h3>
|
---|
101 | <blockquote><pre>
|
---|
102 | <echoproperties/>
|
---|
103 | </pre></blockquote>
|
---|
104 | <p>Report the current properties to the log.</p>
|
---|
105 | <blockquote><pre>
|
---|
106 | <echoproperties destfile="my.properties"/>
|
---|
107 | </pre></blockquote>
|
---|
108 | <p>Report the current properties to the file "my.properties", and will
|
---|
109 | fail the build if the file could not be created or written to.</p>
|
---|
110 | <blockquote><pre>
|
---|
111 | <echoproperties destfile="my.properties" failonerror="false"/>
|
---|
112 | </pre></blockquote>
|
---|
113 | <p>Report the current properties to the file "my.properties", and will
|
---|
114 | log a message if the file could not be created or written to, but will still
|
---|
115 | allow the build to continue.</p>
|
---|
116 | <blockquote><pre>
|
---|
117 | <echoproperties prefix="java."/>
|
---|
118 | </pre></blockquote>
|
---|
119 | <p>List all properties beginning with "java."</p>
|
---|
120 | <blockquote><pre>
|
---|
121 | <echoproperties>
|
---|
122 | <propertyset>
|
---|
123 | <propertyref prefix="java."/>
|
---|
124 | </propertyset>
|
---|
125 | </echoproperties>
|
---|
126 | </pre></blockquote>
|
---|
127 | <p>This again lists all properties beginning with "java." using a nested
|
---|
128 | <tt></propertyset></tt> which is an equivalent but longer way.</p>
|
---|
129 | <blockquote><pre>
|
---|
130 | <echoproperties regex=".*ant.*"/>
|
---|
131 | </pre></blockquote>
|
---|
132 | <p>Lists all properties that contain "ant" in their names.
|
---|
133 | The equivalent snippet with <tt></propertyset></tt> is:</p>
|
---|
134 | <blockquote><pre>
|
---|
135 | <echoproperties>
|
---|
136 | <propertyset>
|
---|
137 | <propertyref regex=".*ant.*"/>
|
---|
138 | </propertyset>
|
---|
139 | </echoproperties>
|
---|
140 | </pre></blockquote>
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 | </body>
|
---|
145 | </html>
|
---|
146 |
|
---|