Java Reference
In-Depth Information
Although not available in the early releases, Geronimo may add a “hot
deploy” feature where the EAR file can just be put into a deploy directory and
the rest will happen automatically. Even so, what will be happening behind the
scenes is this same deploy step.
23.4
M AINTAINING A D ISTRIBUTED A PPLICATION
The deployment is easy if you have the EAR file built properly. But as you just
saw, that can be a big “if”—the EAR consists of several layers of files that must
be in the right place and have the right contents. There are tools to help with
all this, though. Ant is widely used to automate many of these tasks.
23.4.1
In previous chapters we've talked about CVS for managing sources and Ant
for automating our builds. The first step to making all this work together is
something that we should have covered sooner—using CVS with Ant. 2
Example 23.7 is a simple Ant buildfile ( build.xml ) that will let you get
the source from your CVS repository by supplying a particular CVS tag. You
name the tag (which you would have previously applied to your sources) and
this Ant target will check out that version. The files are put in the srctree
directory off of the basedir of the Ant project.
You will have to modify this script to make it fit your environment. The
cvsRoot and csvRsh values correspond to the CVSROOT and CVS_RSH environ-
ment variables that you would otherwise have set for working with CVS. The
package attribute should be set to the project directory that you would specify
when you check out sources. The directory specified by the dest attribute will
be created if it doesn't exist.
The next task to accomplish with Ant is the construction of the EAR,
WAR, and JAR files. Since all three files are essentially just JAR files, we can
use the Ant jar task. The EAR contains a WAR and a JAR, and those in turn
contain Java class files (and a few miscellaneous files). Using the depends
attribute, we can build them in steps.
Ant and CVS
2. So, aren't you glad that you've kept reading and gotten this far? Ah, the rewards of
persistence!
Search WWH ::




Custom Search