How do I use a build.properties file?
Author: Deron Eriksson
Description: This tutorial describes how to use an Ant build.properties file.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1
(Continued from page 1)
The build.properties file used in this tutorial is shown below. I originally created the project-name, builder, ftp-server, ftp-userid, and ftp-password properties and placed them in my build.xml file. I removed these properties from build.xml and put them in build.properties. My build.xml file contains a property pointing to the build.properties file, and the build.properties file contains the names and values of the 5 aforementioned properties.
#build.properties file project-name=tomcat-demo builder=TeamCakes ftp-server=SERVER_GOES_HERE ftp-userid=USERID_GOES_HERE ftp-password=PASSWORD_GOES_HERE
The execution of the 'all' target is shown in Eclipse's console.
As you can see, build.properties files are very easy to use. They offer a convenient way of extracting out properties from your build.xml files. This can be useful for things such as creating build.xml files that can be run for different projects or different environments, where the differences are contained in different versions of the build.properties files that utilize the same build.xml file.