April 2005
Intermediate to advanced
336 pages
7h 20m
English
Fundamentally, deploying to Enterprise JavaBean (EJB) application servers is similar to other Ant deployment projects you've seen. You can use the tasks covered to package and deploy EJB applications. For example, you can see a build file developed for the JBoss server in Example 8-6; this build file first creates a .war file and then packages it into an .ear file for deployment.
Example 8-6. A Jboss EJB build (ch08/ejb/build.xml)
<?xml version="1.0" ?> <project default="main" basedir="."> <target name="main" depends="init, compile, war, ear"/> <target name="init"> <property name="src" value="${basedir}/src"/> <property name="bin" value="${basedir}/output"/> <property name="web" value="${basedir}/web"/> <property name="descriptors" value="${basedir}/output/deploymentdescriptors"/> <property name="eardir" value="${basedir}/output/ear"/> <property name="wardir" value="${basedir}/output/war"/> <property name="warfile" value="app.war"/> <property name="earfile" value="app.ear"/> <mkdir dir="${wardir}/WEB-INF"/> <mkdir dir="${wardir}/WEB-INF/classes"/> <mkdir dir="${eardir}/META-INF"/> </target> <target name="compile"> <javac destdir="${bin}" srcdir="${src}" includes="**/*.java" /> </target> <target name="war"> <copy todir="${wardir}"> <fileset dir="${web}" includes="**/*.*" /> </copy> <copy file="${descriptors}/web.xml" todir="${wardir}/WEB-INF" /> <copy todir="${wardir}/WEB-INF/classes"> <fileset dir="${bin}" includes="**/*.class" /> </copy> <jar jarfile="${eardir}/${warfile}" ...