Java™ Pet Store Demo 1.4 > Building the Demo
Java BluePrints

Building the Demo

We use Ant version 1.5.1 to build the source code. Ant is a Java-based build tool like make, which has been developed under the auspices of the Apache Software Foundation. A working version of Ant is provided as part of the Java Pet Store Demo bundle.

Note: The Java Pet Store Demo bundle comes with pre-built binaries. To deploy these binaries and avoid building the application, consult the installation instructions.


1.0 Building Pet Store Demo

This section explains how to build the application binaries for the petstore application which uses JMS for communication between the Order Processing Center and the Supplier. Building all the application binaries and performing other tasks with Ant involves running the top-level build script in the root directory of the demo installation.

Before building the application, you need to configure the <petstore.home>/src/build.properties file to match your enviroment. You need to set the following properties:
Property Name
Description
Examples
pathsep
The OS dependent path seperator
; (on Windows) or : (on Unix)
dirsep
The OS dependent dir seperator
\ (on Windows) or / (on Unix)

To build the application binaries on Unix, open a shell prompt and enter these commands:

cd <petstore.home>/src
asant [argument]
To build the application binaries on Windows, open a shell prompt and enter these commands:
cd <petstore.home>\src
asant [argument]
When the build script, build.xml, is invoked without any arguments, all the application binaries are built. The binaries are placed in the following folders:
<petstore.home>/src/apps/admin/build/petstoreadmin.ear
<petstore.home>/src/apps/opc/build/opc.ear
<petstore.home>/src/apps/petstore/build/petstore.ear
<petstore.home>/src/apps/supplier/build/supplier.ear

and copied to top level directory for convience:

<petstore.home>/petstoreadmin.ear
<petstore.home>/opc.ear
<petstore.home>/petstore.ear
<petstore.home>/supplier.ear
The following table lists possible arguments for the top-level build script:

Arguments for asant


Option Purpose
core Builds everything. (This is the default build target.)
clean Cleans out the build output directories.
deploy Deploys the application binaries.
undeploy Undeploys the application binaries.
verify
Verifies the application binaries.
docs Builds the application Javadocs.

1.1 Building a Single Application

To build a single application, run the build script (build.xml) in <petstore.home>/src/apps/<app>/src , where <app> is one of the following: The application binary (an EAR file) is placed in <petstore.home>/src/apps/<app>/build and copied to<petstore.home>/ for convience . You can deploy this EAR file by running the build script again, but this time using the deploy argument.

1.2 Building with the Forte[tm] for Java IDE

The Forte for Java IDE supports Ant build files. Just double click on the build.xml file in various directories to start a build. TheForte for Java IDE may need to be properly configured for build.xml ant files to work (library paths, classpaths, etc.) .


Copyright © 2004 Sun Microsystems, Inc. All Rights Reserved.