...
With this command, ant will use the targets defined in the jboss-build.xml file to build the College Fest application and deploy it to the JBoss server. Take a special look at <target name="deploy" ...>, here is where the jboss-build.xml tell ant where to deploy the WAR file. The following example shows the definitions in the jboss-build.xml file.
Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | jboss-build.xmlxml |
---|
|
<?xml version="1.0"?>
<!-- build file for building a war -->
<project name="build" default="war" basedir=".">
<property file="build.properties"/>
<property name="src.dir" value="src"/>
<property name="dest.dir" value="bin"/>
<target name="clean" description="Delete all generated files">
<echo message="Deleting bin directory" />
<delete dir="bin" />
</target>
<target name="compile">
<mkdir dir="${dest.dir}"/>
<javac srcdir="${src.dir}" destdir="${dest.dir}">
<classpath path="${java.home}/lib/tools.jar"/>
<classpath path="${j2ee.home}/lib/j2ee.jar"/>
</javac>
</target>
<target name="war" depends="compile">
<war destfile="college_fest.war" webxml="WEB-INF/web.xml">
<zipfileset dir="jsp" prefix="jsp"/>
<zipfileset dir="pix" prefix="pix"/>
<classes dir="${dest.dir}"/>
<webinf dir="WEB-INF" />
</war>
</target>
<target name="deploy" depends="war">
<copy file="college_fest.war" todir="${jboss.server}/deploy"/>
</target>
<target name="undeploy">
<delete file="${jboss.server}/deploy/college_fest.war"/>
</target>
</project>
|
The war created by the ant build contains a JBoss specific deployment descriptor, the jboss-web.xml file in the WEB-INF directory of the WAR is shown in the following example.
Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | JBoss deployment descriptorxml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>college_fest</context-root>
<context-priority-classloader>
false
</context-priority-classloader>
</jboss-web> |
...
Note |
---|
The following geronimo-web.xml was generated using the J2G tool. |
Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | Geronimo specific deployment plan geronimo-web.xmlxml |
---|
|
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"
xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
<sys:environment>
<sys:moduleId>
<sys:groupId>j2g</sys:groupId>
<sys:artifactId>web-module</sys:artifactId>
<sys:version>1.0</sys:version>
<sys:type>war</sys:type>
</sys:moduleId>
<sys:dependencies/>
</sys:environment>
<context-root>college_fest</context-root>
</web-app>
|
...
Last time you built the College Fest sample application it was configured for ant to use the jboss-build.xml file instead of the default build.xml. The following example shows the content of the default build.xml file.
Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | build.xmlxml |
---|
|
<?xml version="1.0"?>
<!-- build file for building a war -->
<project name="build" default="war" basedir=".">
<property file="build.properties"/>
<property name="src.dir" value="src"/>
<property name="dest.dir" value="bin"/>
<target name="clean" description="Delete all generated files.">
<echo message="Deleting bin folder" />
<delete dir="bin"/>
</target>
<target name="compile">
<mkdir dir="${dest.dir}"/>
<javac srcdir="${src.dir}" destdir="${dest.dir}">
<classpath path="${java.home}/lib/tools.jar"/>
<!--classpath path="${j2ee.home}/lib/j2ee.jar"/-->
<classpath path="${geronimo.home}/repository/org/apache/geronimo/specs/geronimo-servlet_2.5_spec/1.1/geronimo-servlet_2.5_spec-1.1.jar" />
</javac>
</target>
<target name="war" depends="compile">
<war destfile="college_fest.war" webxml="WEB-INF/web.xml">
<zipfileset dir="jsp" prefix="jsp"/>
<zipfileset dir="pix" prefix="pix"/>
<classes dir="${dest.dir}"/>
<webinf dir="WEB-INF" />
</war>
</target>
</project>
|
...