13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

516Chapter 23Deploying EJBsAlthough not available in the early releases, Ger<strong>on</strong>imo may add a “hotdeploy” feature where the EAR file can just be put into a deploy directory andthe rest will happen automatically. Even so, what will be happening behind thescenes is this same deploy step.23.4MAINTAINING A DISTRIBUTED APPLICATIONThe deployment is easy if you have the EAR file built properly. But as you justsaw, that can be a big “if”—the EAR c<strong>on</strong>sists of several layers of files that mustbe in the right place and have the right c<strong>on</strong>tents. There are tools to help withall this, though. Ant is widely used to automate many of these tasks.23.4.1 Ant and CVSIn previous chapters we’ve talked about CVS for managing sources and Antfor automating our builds. The first step to making all this work together issomething that we should have covered so<strong>on</strong>er—using CVS with Ant. 2Example 23.7 is a simple Ant buildfile (build.xml) that will let you getthe source from your CVS repository by supplying a particular CVS tag. Youname the tag (which you would have previously applied to your sources) andthis Ant target will check out that versi<strong>on</strong>. The files are put in the srctreedirectory off of the basedir of the Ant project.You will have to modify this script to make it fit your envir<strong>on</strong>ment. ThecvsRoot and csvRsh values corresp<strong>on</strong>d to the CVSROOT and CVS_RSH envir<strong>on</strong>mentvariables that you would otherwise have set for working with CVS. Thepackage attribute should be set to the project directory that you would specifywhen you check out sources. The directory specified by the dest attribute willbe created if it doesn’t exist.The next task to accomplish with Ant is the c<strong>on</strong>structi<strong>on</strong> of the EAR,WAR, and JAR files. Since all three files are essentially just JAR files, we canuse the Ant jar task. The EAR c<strong>on</strong>tains a WAR and a JAR, and those in turnc<strong>on</strong>tain Java class files (and a few miscellaneous files). Using the dependsattribute, we can build them in steps.2. So, aren’t you glad that you’ve kept reading and gotten this far? Ah, the rewards ofpersistence!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!