1. Set up the environment.
2. Go to the directory that contains the build.xml file for the model.
3. Run Ant.
Successfully running the build script gives us the following output: Buildfile: build.xml
If you do not get this output, check that the properties defined in the init target make sense for your environment. If you are on a Unix platform and the build file is not working, make sure that the /tmp directory exists and that you have the rights to access it. Alternatively, you could run the previous script by entering this on the command line:
$ ant -Doutdir=/usr/rick/tmp/appBasically, you want to output to a directory that you have access to, just in case you are not the administrator of your own box. If for some reason Ant still does not run, make sure you set up the Ant environment variables.
After you successfully run Ant, the output directory for the model project looks like this:Root of output directory
\---app
+---lib
| greetmodel.jar
|
\---model
\---classes
\---xptoolkit
\---model
GreetingFactory.class
Greeting.class
GreetingBean.class
Notice that all the intermediate files to build the JAR file are in the model subdirectory. The output from this project is the greetmodel.jar file, which is in ${outdir}/app/lib. The next project, the application project, needs this JAR file in order to compile. In the next section, we discuss how to use Ant to build a stand-alone Java application that uses the JAR file (greetmodel.jar) from the model project.