Setting Properties in an Ant Script
You can configure properties in your Ant scripts at both the project and target
levels. There are two ways of adding Ant properties to your Ant script:
- As XML tags in the Ant file itself
- As properties in a separate properties (ant.properties) file
To add a property as an XML tag in your Ant script:
- Right-click the script's Ant project node.
- Choose Add
property.
A property with the default name and value is inserted at the end of the project.
A task node (
) for the
property appears in the Explorer.
To define your Ant script's properties in a separate properties file:
- Right-click the Ant project node in the Explorer and choose Properties.
If you want to set a separate properties file for a target, right-click the
target node and choose Properties.
- Click the ellipsis button in Project Properties or Target Properties. The
Create Properties File wizard opens.
- Change name for the properties file name if necessary, or click Next to
accept the default name. The IDE automatically appends the file name with
the .ant.properties suffix.
- Type your properties in the text area. Form properties using the same syntax
as regular properties files (key=value) without quotation
marks. Click Finish.
The properties file is created in the same directory as your Ant project
and a <property file="filename">
tag is added to your Ant script. You can edit the properties by going to
the property sheet for the Ant project or target and clicking Project Properties
or Target Properties. Alternatively, you can double-click the properties
file to work with it in the properties pane of Source Editor.
You can edit the contents of a properties file in either of the following
ways:
- Right-click the Ant project or target node and choose Properties. Then click
the ellipsis button in Project Properties or Target Properties. A dialog box
displays in which you can edit your Ant script's properties.
- Double-click the properties file's node in the Explorer. The properties
file opens in the Source Editor's tabbed properties pane.
To change the properties file referenced by your Ant script:
- Right-click the project or target's node in the Explorer and choose Properties.
- Select a different properties file from the Switch Properties File combo
box. This combo box lists all of the .ant.properties files in the
present directory.
Alternatively, you can change the value of the <property file="..."/>
tag directly in your script, or select the property task node and change the
file attribute in its property sheet.
 |
In addition to your user-defined properties, the IDE also includes a
set of global properties that are passed to Ant each time you run an Ant
script. To view these properties, choose Tools Options
and expand the Building node. Then select Ant Properties and click the
ellipsis button in the Properties setting.
|
Legal Notices