ANT Property Files

Properties are a good way to keep your ant tasks customizable. Here is a example of how to use property files.

Flex.SDK = /opt/flex_sdk_4
Flex.Source = source
Flex.Build = build
Flex.Working = working

Flex.Source = my_custom_source
Flex.Build = my_custom_build
Flex.Working = my_custom_working


<?xml version="1.0" encoding="utf-8"?>
<project name="Test" basedir=".">
	<property file=""/>
	<property file=""/>


Buildfile: build.xml
     [echo] /opt/flex_sdk_4
     [echo] my_custom_source
     [echo] my_custom_build
     [echo] my_custom_working

Total time: 0 seconds

You’ll notice that I included the file first and the variables in there are the true values once everything is loaded. I would have thought this would be backwards. But the easy fix for overwriting properties is to switch the load order.

Source Code


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s