February 2005
Intermediate to advanced
528 pages
12h 53m
English
You want to be able to build and deploy your Struts web application in a repeatable and portable manner.
Create an Ant (http://ant.apache.org) build script and use Ant (or your IDE's Ant integration) to compile, test, package, and deploy your application. Example 1-8 is a boilerplate Ant build file that can compile, build, and deploy a Struts application.
Example 1-8. Boilerplate Ant build file
<project name="jsc-ch01-r02" default="dist" basedir="."> <description> Jakarta Struts Cookbook - Ant Template </description> <!-- Enable access to environment variables --> <property environment="env"/> <!-- Set to use JDK 1.4 --> <property name="build.compiler" value="javac1.4"/> <!-- set global properties for this build --> <property name="src.dir" location="src"/> <property name="build.dir" location="build"/> <property name="dist.dir" location="dist"/> <property name="server.dir" location="${env.CATALINA_HOME}"/> <property name="servlet.jar" location="${server.dir}/common/lib/servlet-api.jar"/> <property name="jsp.jar" location="${server.dir}/common/lib/jsp-api.jar"/> <property name="struts.dist.dir" location="c:/jakarta-struts-1.1/lib"/> <!-- Struts --> <fileset id="struts.lib.files" dir="${struts.dist.dir}"> <include name="**/*.jar"/> </fileset> <path id="struts.classpath"> <fileset refid="struts.lib.files"/> </path> <path id="project.class.path"> <pathelement location="${servlet.jar}"/> <pathelement location="${jsp.jar}"/> <path refid="struts.classpath"/> ...