buildapps.xml
is an Ant file that you invoke by
calling the command ant
.
You use this build file when you want your application to be able to run in
a container such as Tomcat or in a JavaTM 2
Platform, Enterprise Edition (J2EETM) container.
For a standalone application, you do not need to use this build file.
The file buildapps.xml
constructs a directory structure in which
you can write your application, so you call it before you write your code.
When you have finished your application, you call it again to create a
.war
(Web Archive) file.
Conventions used in this document:
jaxmapp
.
cd $JWSDP_HOME/work mkdir jaxmapp
WEB-INF
directory under jaxmapp
.
cd jaxmapp mkdir WEB-INF
buildapps.xml
file into the WEB-INF
directory, changing its name to build.xml
.
cd WEB-INF cp $JWSDP_HOME/docs/jaxm/buildapps.xml build.xmlWhen you call the
ant
command, it will look for
this build.xml
file.
build.properties
in the WEB-INF
directory and give it the specified name/value pairs. The following shows what
your file might look like for Unix. You will need to make the appropriate changes
for Windows. /home/happy/installs/JWSDP
is the directory that contains
Tomcat. You must write out the full path name because environment variables
will not be handled properly.
servlet.jar=/home/happy/installs/JWSDP/common/lib/servlet.jar webapps.dir=/home/happy/installs/JWSDP/webapps appname=jaxmapp appdir=/home/happy/installs/JWSDP/work/jaxmapp wars.dir=/home/happy/installs/JWSDP/webapps jaxm.home=/home/happy/installs/JWSDPNote that the information in the
build.properties
file can be
supplied at the command line, but it is generally more convenient to use
a properties file.
ant
command as follows.
If you have not already added $JWSDP_HOME/bin
to your PATH, you
should do so now. We recommend putting it at the beginning of your PATH to be
sure you get the right version if you have downloaded a
JavaTM XML Pack release previously.
cd $JWSDP_HOME/work/jaxmapp/WEB-INF antThe result of this call is the creation of several directories in the Tomcat directory structure.
jaxmapp
in
$JWSDP_HOME/webapps
and the directory
WEB-INF
as a subdirectory under jaxmapp
.
So, you will now have the following:
$JWSDP_HOME/webapps/jaxmapp/WEB-INFThe
WEB-INF
directory contains the following subdirectories:
classes lib srcNow you need to populate this directory structure by doing the following:
WEB-INF/src
directory.
WEB-INF/classes
directory.
The file client.xml
also needs to be in the WEB-INF/classes
directoryWEB-INF
directory.$JWSDP-HOME/common/lib/jaxm-client.jar
into the
WEB-INF/lib
directory.
.war
file for your application with
the same ant
command you used before except with "war" appended
to it. It will look like this:
cd $JWSDP_HOME/work/jaxmapp/WEB-INF ant warThis will create the file
jaxmapp.war
in the
$JWSDP_HOME/webapps
directory.