The Ant Build Scripts


All of the programs provided with this book are built with Ant, a build tool from Apache's Ant project. Build scripts are provided for four different implementations:

  • The reference implementation from Sun Microsystems

  • The Kodo implementation from SolarMetric

  • The Lido implementation from Libelis

  • The IntelliBO implementation from SignSoft

A new script could be added for any other JDO implementation as long as the implementation supplies command line tools that can be used with Ant. The scripts were tested with version 1.4.1 of Ant, and they should work with any later 1.x version of Ant. It is strongly recommended that you use Ant to build the JDO Learning Tools.

Ant's build scripts are XML files. The major build scripts are in the bookants directory. The build scripts that compile the individual programs are in each project directory. The main build script, called build.xml, reads three property files in the bookants directory to set its configuration. The global.properties file contains properties that you should not have to change. The custom.properties file is tailored to the particular JDO tool that you are using. You will want to modify the appropriate property file for the tool, such as jdori.properties, and then make a copy of it that is named custom.properties. The default.properties file sets properties that must be customized to your installation.

The main Ant build script reads the property files in the following order:

  1. global.properties

  2. custom.properties

  3. default.properties

Because all Ant properties are final, if a property is set in more than one property file, the value that sticks is the first value encountered. As a result, if the property jdo.tool is encountered in the custom.properties file as well as in the default.properties file, the value in the custom.properties file is the one used.

In order to work with a variety of JDO implementations, the build scripts are a bit more complicated than they would be in a typical development environment. The main build.xml script calls out to one of several possible tool scripts that are individually configured to the specific JDO implementation. There are four supplied with the code: jdori.xml, kodo.xml, lido.xml, and intellibo.xml. Only one tool script is used in any build environment. The tool script selection is controlled by the jdo.tool property in the custom.properties file. To minimize needless redundancy, the tool scripts call out to a common set of third-level scripts. Each package has its own compile script to compile the files that are specific to it. These are contained in build.xml scripts that are in the subdirectories of the source. Likewise, each container has a script for compiling and deploying the files that are specific to its needs. These are the tomcat.xml and jboss.xml scripts contained within the bookants directory.

As a result, when you type ant target in the bookants directory, the target is invoked in the following build scripts: in the build.xml script in the bookants directory; in the specific tool script, such as jdori.xml, in the bookants directory; in the build.xml that is in the target's source directory; and finally, if the build deploys on Tomcat or JBoss, then in the tomcat.xml or jboss.xml script in the bookants directory.

Many of the build targets create batch files for Microsoft Windows that run the programs. The current build scripts do not produce command files for other operating systems. As a result, if you are running on Linux or some other operating system, you will have to change the generated batch files so that they can be invoked on your operating system.




Using and Understanding Java Data Objects
Using and Understanding Java Data Objects
ISBN: 1590590430
EAN: 2147483647
Year: 2005
Pages: 156
Authors: David Ezzio

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net