Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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
borderStylesolid
titlejboss-build.xmlxml
<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- 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="compile">
        <mkdir dir="${dest.dir}"/>

        <javac srcdir="${src.dir}" destdir="${dest.dir}">
        <classpath path="${java.home}/lib/tools.jar"/>
        <classpath path="${jboss.server}/lib/javax.servlet.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}"/>
      </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>

<target name="clean">
        <delete file="college_fest.war"/>
        <delete dir="bin"/>
    </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
borderStylesolid
titleJBoss 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>

...

In order to migrate the College Fest application to Geronimo you need to replace the jboss-web.xml file with a geronimo-web.xml file which is the Geronimo specific descriptor file. The geronimo-web.xml file is located in the WEB-INF directory withing the college_fest directory structure. The Geronimo deployment plan geronimo-web.xml is illustrated in the following example.

Code Block
xml
xml
borderStylesolid
titleGeronimo specific deployment plan geronimo-web.xmlxml
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://geronimo.apache.org/xml/ns/web" configId="college_fest">

    <context-root>college_fest</context-root>
    <context-priority-classloader>
      false
    </context-priority-classloader>

</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
borderStylesolid
titlebuild.xmlxml
<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- 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="compile">
        <mkdir dir="${dest.dir}"/>

        <javac srcdir="${src.dir}" destdir="${dest.dir}">
        <classpath path="${java.home}/lib/tools.jar"/>
        <classpath path="${geronimo.server}/repository/org.apache.geronimo.specs/jars/geronimo-j2ee_1.4_spec-1.0.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}"/>

      </war>
</target>

<target name="clean">
        <delete file="college_fest.war"/>
        <delete dir="bin"/>
    </target>

</project>

...