Magazine
 
ANT

<?xml version=”1.0"?>
<project name=”Jboss 3.0 tutorial series”
default=”all” basedir=”.”>
<target name=”init”>
<property name=”dirs.base”
value=”${basedir}”/>
<property name=”classdir”
value=”${dirs.base}/build/src”/>
<property name=”src” value=”${dirs.base}/
src”/>
<property name=”web” value=”${dirs.base}/
web”/>
<property name=”deploymentdescription”
value=”${dirs.base}/build/
deploymentdescriptors”/>
<property name=”warFile”
value=”example2.war”/>
<property name=”earFile”
value=”example2.ear”/>
<property name=”earDir”
value=”${dirs.base}/build/ear”/>
<property name=”warDir”
value=”${dirs.base}/build/war”/>
<!— Create Web-inf and classes directories —
>
<mkdir dir=”${warDir}/WEB-INF”/>
<mkdir dir=”${warDir}/WEB-INF/classes”/>
<!— Create Meta-inf and classes directories —
>
<mkdir dir=”${earDir}/META-INF”/>
</target>
<!— Main target —>
<target name=”all”
depends=”init,build,buildWar,buildEar”/>
<!— Compile Java Files and store in /build/src
directory —>
<target name=”build” >
<javac srcdir=”${src}” destdir=”${classdir}”
debug=”true” includes=”**/*.java” />
</target>
<!— Create the War File —>

 

<target name=”buildWar” depends=”init”>
<copy todir=”${warDir}/WEB-INF/classes”>
<fileset dir=”${classdir}” includes=”**/
*.class” />
</copy>
<copy todir=”${warDir}/WEB-INF”>
<fileset dir=”${deploymentdescription}”
includes=”web.xml” />
</copy>
<copy todir=”${warDir}”>
<fileset dir=”${web}” includes=”**/*.*” />
</copy>
<!— Create war file and place in ear directory
—>
<jar jarfile=”${earDir}/${warFile}”
basedir=”${warDir}” />
</target>
<!— Create the War File —>
<target name=”buildEar” depends=”init”>
<copy todir=”${earDir}/META-INF”>
<fileset dir=”${deploymentdescription}”
includes=”application.xml” />
</copy>
<!— Create ear file and place in ear directory
—>
<jar jarfile=”${dirs.base}/${earFile}”
basedir=”${earDir}” />
</target>
</project>

Above build.xml file is design to create example2.ear for us in the base directory. Running Ant utility to build example2.ear Now it’s time to build example2.ear and deploy on the Jboss 3.2.3 application server. To execute Ant utility go to c:\anttest\example2 directory and issue ant
command.

 Dec 2007 | Java Jazz Up | 39
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 ,

Download PDF