Developing Web Applications With Ant by Richard Hightower - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Using Properties

Look at the number of environment variables being used in Listing 20.3: jdbc.jar, jdbc.driver, jdbc.userid, jdbc.password, jdbc.url, jdbc.jar, and build.sql. Defining properties can quickly become tedious, and often properties vary quite a bit from development environments to integration, QA, and production environments--so it makes sense to define properties in another file.

<project name="EJBQL" default="compile" >
<property environment="env"/>
<property file="build.properties" />

<target name="createtables">
<sql driver="${jdbc.driver}" url="${jdbc.url}"
userid="${jdbc.userid}" password="${jdbc.password}" src="${build.sql}" print="yes">

<classpath>
<pathelement location="${jdbc.jar}"/>
</classpath>
</sql>
</target>
...

Listing 20.3