Setting Properties in Ant Scripts

You can configure properties in your Ant scripts at both the project and target levels. The are two ways of handling Ant properties in the IDE: As XML tags in the Ant file itself, or as properties in a separate properties (.properties) file.

To add a property as an XML tag in your Ant script:

  1. Right-click the script's Ant project node.
  2. Choose Add and choose property. A property with the default name and value is inserted at the end of the project. A property task node for the property appears in the Explorer.

To define your Ant script's properties in a separate properties file:

  1. 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.
  2. Click the ellipsis in the Project Properties or Target Properties field. The Create Properties File wizard opens.
  3. The first panel of the wizard shows the default name for the properties file. The IDE automatically appends the file name with the .ant.properties suffix. Change this name if necessary, or click Next to proceed.
  4. Enter your properties in the Add Properties panel. Enter properties using the same syntax as regular properties files (key=value) without quotation marks. Click Finish.

    The properties file is created in the specified location 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.

To change the properties file referenced by your Ant script:

  1. Right-click the project or target's node in the Explorer and choose Properties.
  2. Choose 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.
See also

Ant Project Files
Executing a Target
Modifying a .properties File


Legal Notices