craigmcc 01/03/09 22:21:40
Modified: . build.xml
Added: . build-webapp.xml build-webapps.xml
Log:
Refactor the build scripts so that creating the web applications is split
into two different Ant buildfiles:
* build-webapps.xml -- Builds all the Struts webapps
* build-webapp.xml -- Generic build file that can serve as the basis
for building *any* web application. Used by "build-webapps.xml"
for all of the Struts standard web applications.
Revision Changes Path
1.43 +29 -291 jakarta-struts/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/build.xml,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- build.xml 2001/03/10 05:15:31 1.42
+++ build.xml 2001/03/10 06:21:40 1.43
@@ -30,103 +30,10 @@
</copy>
</target>
- <!-- BUILD: Create directories and copy files for blank application -->
- <target name="prepare.blank">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/blank"/>
- <mkdir dir="${build.home}/blank/WEB-INF"/>
- <mkdir dir="${build.home}/blank/WEB-INF/classes"/>
- <mkdir dir="${build.home}/blank/WEB-INF/lib"/>
- <copy todir="${build.home}/blank">
- <fileset dir="web/blank"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for documentation app -->
- <target name="prepare.documentation">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/documentation"/>
- <mkdir dir="${build.home}/documentation/dtds"/>
- <copy todir="${build.home}/documentation/dtds">
- <fileset dir="src/conf" includes="**/*.dtd"/>
- </copy>
- <mkdir dir="${build.home}/documentation/userGuide"/>
- <mkdir dir="${build.home}/documentation/WEB-INF"/>
- <mkdir dir="${build.home}/documentation/WEB-INF/classes"/>
- <mkdir dir="${build.home}/documentation/WEB-INF/lib"/>
- <copy todir="${build.home}/documentation">
- <fileset dir="web/documentation"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for example application -->
- <target name="prepare.example">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/example"/>
- <mkdir dir="${build.home}/example/WEB-INF"/>
- <mkdir dir="${build.home}/example/WEB-INF/classes"/>
- <mkdir dir="${build.home}/example/WEB-INF/lib"/>
- <mkdir dir="${build.home}/example/WEB-INF/src"/>
- <copy todir="${build.home}/example/WEB-INF/src">
- <fileset dir="src/example"/>
- </copy>
- <copy todir="${build.home}/example">
- <fileset dir="web/example"/>
- </copy>
- <copy tofile="${build.home}/example/struts-power.gif"
- file="src/doc/images/struts-power.gif"/>
- </target>
-
- <!-- BUILD: Create directories and copy files for exercise-taglib application -->
- <target name="prepare.exercise-taglib">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/exercise-taglib"/>
- <mkdir dir="${build.home}/exercise-taglib/WEB-INF"/>
- <mkdir dir="${build.home}/exercise-taglib/WEB-INF/classes"/>
- <mkdir dir="${build.home}/exercise-taglib/WEB-INF/lib"/>
- <mkdir dir="${build.home}/exercise-taglib/WEB-INF/src"/>
- <copy todir="${build.home}/exercise-taglib/WEB-INF/src">
- <fileset dir="src/exercise-taglib"/>
- </copy>
- <copy todir="${build.home}/exercise-taglib">
- <fileset dir="web/exercise-taglib"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for template example -->
- <target name="prepare.template">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/template"/>
- <mkdir dir="${build.home}/template/css"/>
- <mkdir dir="${build.home}/template/graphics"/>
- <mkdir dir="${build.home}/template/WEB-INF"/>
- <mkdir dir="${build.home}/template/WEB-INF/lib"/>
- <mkdir dir="${build.home}/template/WEB-INF/tlds"/>
- <copy todir="${build.home}/template">
- <fileset dir="web/template-example"/>
- </copy>
- </target>
-
- <!-- BUILD: Create directories and copy files for upload example -->
- <target name="prepare.upload">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/upload"/>
- <mkdir dir="${build.home}/upload/WEB-INF"/>
- <mkdir dir="${build.home}/upload/WEB-INF/lib"/>
- <mkdir dir="${build.home}/upload/WEB-INF/classes"/>
- <copy todir="${build.home}/upload">
- <fileset dir="web/upload" />
- </copy>
- </target>
-
- <!-- DIST: Create directories and copy files for distribution -->
- <target name="prepare.dist">
- <mkdir dir="${dist.home}"/>
- <mkdir dir="${dist.home}/etc"/>
- <mkdir dir="${dist.home}/lib"/>
- <mkdir dir="${dist.home}/src"/>
- <mkdir dir="${dist.home}/web"/>
- <mkdir dir="${dist.home}/webapps"/>
+ <!-- BUILD: Prepare static directories for web applications -->
+ <target name="static.webapps">
+ <ant antfile="build-webapps.xml" target="static">
+ </ant>
</target>
<!-- BUILD: Compile library directory components -->
@@ -153,153 +60,10 @@
basedir="${build.home}/library/classes" includes="**"/>
</target>
- <!-- BUILD: Compile blank application components -->
- <target name="compile.blank"
- depends="dist.library,prepare.blank">
-<!--
- <javac srcdir="src/blank"
- destdir="${build.home}/blank/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="${debug}" optimize="${optimize}"
- deprecation="${deprecation}"/>
- <copy todir="${build.home}/blank/WEB-INF/classes">
- <fileset dir="src/blank" includes="**/*.properties"/>
- </copy>
--->
- <copy todir="${build.home}/blank">
- <fileset dir="web/blank"/>
- </copy>
- <copy file="${build.home}/library/${app.name}.jar"
- tofile="${build.home}/blank/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/blank/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
- </target>
-
- <!-- BUILD: Compile documentation application components -->
- <target name="compile.documentation"
- depends="dist.library,prepare.documentation">
-
- <!-- Compile beans and tags required by the documentation app -->
-<!--
- <javac srcdir="src/documentation"
- destdir="${build.home}/documentation/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="${debug}" optimize="${optimize}"
- deprecation="${deprecation}"/>
--->
-
- <!-- Copy Struts JAR file and TLDs to the documentation app -->
- <copy file="${build.home}/library/${app.name}.jar"
- tofile="${build.home}/documentation/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/documentation/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
-
- <!-- Copy static documentation content -->
- <copy todir="${build.home}/documentation">
- <fileset dir="web/documentation"/>
- </copy>
-
- <!-- Create dynamically generated documentation -->
- <!-- Create the taglib documentation -->
- <style basedir="src/doc" destdir="${build.home}/documentation"
- extension=".html" style="stylesheets/struts.xsl" includes="*.xml"/>
- <!-- Create the user guide -->
- <style basedir="src/doc/userGuide"
- destdir="${build.home}/documentation/userGuide"
- extension=".html" style="../stylesheets/userGuide.xsl"
- includes="*.xml"/>
- <copy todir="${build.home}/documentation">
- <fileset dir="src/doc">
- <include name="**/*.css"/>
- <include name="**/*.gif"/>
- <include name="**/*.html"/>
- <include name="**/*.jpg"/>
- <include name="**/*.js"/>
- </fileset>
- </copy>
- <copy todir="${build.home}/documentation/userGuide">
- <fileset dir="src/doc/userGuide">
- <include name="**/*.css"/>
- <include name="**/*.gif"/>
- <include name="**/*.html"/>
- <include name="**/*.jpg"/>
- <include name="**/*.js"/>
- </fileset>
- </copy>
- </target>
-
- <!-- BUILD: Compile example application components -->
- <target name="compile.example"
- depends="dist.library,prepare.example">
- <javac srcdir="src/example"
- destdir="${build.home}/example/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="${debug}" optimize="${optimize}"
- deprecation="${deprecation}"/>
- <copy todir="${build.home}/example/WEB-INF/classes">
- <fileset dir="src/example" includes="**/*.properties"/>
- </copy>
- <copy todir="${build.home}/example">
- <fileset dir="web/example"/>
- </copy>
- <copy file="${build.home}/library/${app.name}.jar"
- tofile="${build.home}/example/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/example/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
- </target>
-
- <!-- BUILD: Compile template example application components -->
- <target name="compile.template"
- depends="dist.library,prepare.template">
- <copy todir="${build.home}/template">
- <fileset dir="web/template-example"/>
- </copy>
- <copy file="${build.home}/library/${app.name}.jar"
- tofile="${build.home}/template/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/template/WEB-INF/tlds">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
- </target>
-
- <!-- BUILD: Compile upload example application components -->
- <target name="compile.upload"
- depends="dist.library,prepare.upload">
- <javac srcdir="web/upload"
- destdir="${build.home}/upload/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="${debug}" optimize="${optimize}"
- deprecation="${deprecation}"/>
- <copy todir="${build.home}/upload">
- <fileset dir="web/upload" />
- </copy>
- <copy file="${build.home}/library/${app.name}.jar"
- tofile="${build.home}/upload/WEB-INF/lib/${app.name}.jar"/>
- <copy file="${dist.home}/lib/${app.name}-html.tld"
- todir="${build.home}/upload/WEB-INF" />
- </target>
-
- <!-- BUILD: Compile exercise-taglib application components -->
- <target name="compile.exercise-taglib"
- depends="dist.library,prepare.exercise-taglib">
- <javac srcdir="src/exercise-taglib"
- destdir="${build.home}/exercise-taglib/WEB-INF/classes"
- classpath="${build.home}/library/classes:${servlet.jar}"
- debug="${debug}" optimize="${optimize}"
- deprecation="${deprecation}"/>
- <copy todir="${build.home}/exercise-taglib/WEB-INF/classes">
- <fileset dir="src/exercise-taglib" includes="**/*.properties"/>
- </copy>
- <copy todir="${build.home}/exercise-taglib">
- <fileset dir="web/exercise-taglib"/>
- </copy>
- <copy file="${build.home}/library/${app.name}.jar"
- tofile="${build.home}/exercise-taglib/WEB-INF/lib/${app.name}.jar"/>
- <copy todir="${build.home}/exercise-taglib/WEB-INF">
- <fileset dir="${dist.home}/lib" includes="*.tld"/>
- </copy>
+ <!-- BUILD: Compile code for web applications -->
+ <target name="compile.webapps" depends="compile.library">
+ <ant antfile="build-webapps.xml" target="compile">
+ </ant>
</target>
<!-- BUILD: Create Javadoc documentation -->
@@ -318,6 +82,16 @@
bottom="Copyright © 2000-2001 - Apache Software Foundation"/>
</target>
+ <!-- DIST: Create directories and copy files for distribution -->
+ <target name="prepare.dist">
+ <mkdir dir="${dist.home}"/>
+ <mkdir dir="${dist.home}/etc"/>
+ <mkdir dir="${dist.home}/lib"/>
+ <mkdir dir="${dist.home}/src"/>
+ <mkdir dir="${dist.home}/web"/>
+ <mkdir dir="${dist.home}/webapps"/>
+ </target>
+
<!-- DIST: Construct library distributables -->
<target name="dist.library" depends="prepare.dist,compile.library">
<copy todir="${dist.home}/lib">
@@ -326,42 +100,11 @@
<fileset dir="${build.home}/library" includes="*.tld"/>
</copy>
</target>
-
- <!-- DIST: Construct blank distributables -->
- <target name="dist.blank" depends="dist.library,compile.blank">
- <jar jarfile="${dist.home}/webapps/${app.name}-blank.war"
- basedir="${build.home}/blank" includes="**"/>
- </target>
-
- <!-- DIST: Construct documentation distributables -->
- <target name="dist.documentation"
- depends="dist.library,compile.documentation,compile.javadoc">
- <jar jarfile="${dist.home}/webapps/${app.name}-documentation.war"
- basedir="${build.home}/documentation" includes="**"/>
- </target>
-
- <!-- DIST: Construct example distributables -->
- <target name="dist.example" depends="dist.library,compile.example">
- <jar jarfile="${dist.home}/webapps/${app.name}-example.war"
- basedir="${build.home}/example" includes="**"/>
- </target>
-
- <!-- DIST: Construct template example distributables -->
- <target name="dist.template" depends="dist.library,compile.template">
- <jar jarfile="${dist.home}/webapps/${app.name}-template.war"
- basedir="${build.home}/template" includes="**"/>
- </target>
-
- <!-- DIST: Construct exercise-taglib distributables -->
- <target name="dist.exercise-taglib"
depends="dist.library,compile.exercise-taglib">
- <jar jarfile="${dist.home}/webapps/${app.name}-exercise-taglib.war"
- basedir="${build.home}/exercise-taglib" includes="**"/>
- </target>
- <!-- DIST: Construct upload example distributables -->
- <target name="dist.upload" depends="dist.library,compile.upload">
- <jar jarfile="${dist.home}/webapps/${app.name}-upload.war"
- basedir="${build.home}/upload" includes="**"/>
+ <!-- DIST: Construct distributable web applications -->
+ <target name="dist.webapps" depends="compile.javadoc">
+ <ant antfile="build-webapps.xml" target="dist">
+ </ant>
</target>
<!-- DIST: Copy sources -->
@@ -382,10 +125,10 @@
<!-- DIST: Construct complete release distribution -->
<target name="dist"
-
depends="dist.library,dist.blank,dist.documentation,dist.example,dist.template,dist.exercise-taglib,dist.upload,dist.source"/>
+ depends="dist.library,dist.webapps,dist.source"/>
<!-- DEPLOY: Deploy these applications on Catalina -->
- <target name="deploy.catalina"
depends="compile.blank,compile.documentation,compile.example,compile.template,compile.exercise-taglib,compile.upload">
+ <target name="deploy.catalina" depends="compile.webapps">
<mkdir dir="${catalina.home}/webapps/struts-blank"/>
<copy todir="${catalina.home}/webapps/struts-blank">
<fileset dir="${build.home}/blank"/>
@@ -409,7 +152,7 @@
</copy>
<mkdir dir="${catalina.home}/webapps/struts-template"/>
<copy todir="${catalina.home}/webapps/struts-template">
- <fileset dir="${build.home}/template"/>
+ <fileset dir="${build.home}/template-example"/>
</copy>
<copy todir="${catalina.home}/webapps/struts-template/WEB-INF/lib">
<fileset dir="${xerces.home}" includes="xerces.jar"/>
@@ -431,7 +174,7 @@
</target>
<!-- DEPLOY: Deploy these applications on Tomcat -->
- <target name="deploy.tomcat"
depends="compile.blank,compile.documentation,compile.example,compile.template,compile.exercise-taglib,compile.upload">
+ <target name="deploy.tomcat" depends="compile.webapps">
<mkdir dir="${tomcat.home}/webapps/struts-blank"/>
<copy todir="${tomcat.home}/webapps/struts-blank">
<fileset dir="${build.home}/blank"/>
@@ -446,7 +189,7 @@
</copy>
<mkdir dir="${tomcat.home}/webapps/struts-template"/>
<copy todir="${tomcat.home}/webapps/struts-template">
- <fileset dir="${build.home}/template"/>
+ <fileset dir="${build.home}/template-example"/>
</copy>
<mkdir dir="${tomcat.home}/webapps/struts-exercise-taglib"/>
<copy todir="${tomcat.home}/webapps/struts-exercise-taglib">
@@ -466,14 +209,9 @@
<echo message="The following targets are available:"/>
<echo message=" all Cleans and builds library and
webapps"/>
<echo message=" clean Cleans the build and distribution
directories"/>
- <echo message=" compile.blank Builds the blank starter app"/>
- <echo message=" compile.documentation Builds the documentation webapp"/>
- <echo message=" compile.example Builds the examples webapp"/>
<echo message=" compile.javadoc Builds Javadoc API docs for Struts"/>
<echo message=" compile.library Builds the main packages"/>
- <echo message=" compile.template Builds the template example webapp"/>
- <echo message=" compile.upload Builds the upload example webapp"/>
- <echo message=" compile.exercise-taglib Builds the exercise-taglibs webapp"/>
+ <echo message=" compile.webapps Builds the web applications"/>
<echo message=" deploy.catalina Deploys build to Catalina build
directory"/>
<echo message=" deploy.tomcat Depoys build to Tomcat build
directory"/>
<echo message=" dist Builds binary distribution in dist
directory"/>
@@ -488,6 +226,6 @@
<!-- UTILITY: All-in-one build target -->
<target name="all"
-
depends="clean,compile.library,compile.documentation,compile.example,compile.exercise-taglib"/>
+ depends="clean,compile.library,compile.webapps"/>
</project>
1.1 jakarta-struts/build-webapp.xml
Index: build-webapp.xml
===================================================================
<project name="Generic Webapp" default="compile" basedir=".">
<!--
This is a generic build.xml file for Ant that can be used to develop
any web application that conforms to the following requirements:
- Web sources appear in the directory specified by the "webapp.web"
property, in exactly the hierarchy to be present in the created
web application archive.
- Java sources (if any) appear in the directory specified by the
"webapp.src" property, which will be compiled into the
"WEB-INF/classes" directory of the resulting web application.
- You must specify a "servlet.jar" property that defines the path
of the servlet API classes you will compile against.
- If you want to copy Struts libraries and TLD files to your web
application, set the "struts.libs" property to the pathname of a
directory containing struts.jar and the associated *.tld files.
- If you want to copy additional JAR files into the WEB-INF/lib
directory of your web app, set the "webapp.libs" property to the
pathname of a directory containing the JAR files to be copied.
-->
<!-- ========== Prerequisite Properties =================================== -->
<!--
These properties MUST be set on the "ant" command line, the "antrc"
properties file in your home directory, or from settings in a superior
build.xml script, if you wish to take advantage of the corresponding
functionality.
compile.classpath The class path containing external
JAR files and directories required for
compiling this web application. Note
that struts.jar will automatically be
added if "struts.lib" is defined, and
dependent JAR files will be added if
"webapp.libs" is defined.
servlet.jar MUST be set to the pathname of the
servlet API classes you wish to
compile against.
struts.libs If specified, must be the pathname of a
directory from which "struts.jar" will be
copied to your WEB-INF/lib directory, and
from which all TLD files will be copied
to your WEB-INF directory. Also, the
struts.jar file will automatically be
added to your compile classpath.
webapp.libs If specified, must be the pathname of a
directory from which all available
"*.jar" files are copied to the web
application's WEB-INF/lib directory.
Also, any JAR files found here will
automatically be added to your compile
classpath.
webapp.name MUST be set to the base name of the web
application archive file that will be
created for this web application.
webapp.suppress Set this property to an arbitrary value
(such as "true") if you do NOT want the
source code for your web application
copied to the WEB-INF/src directory.
webapp.war If specified, overrides the default name
of the web application archive file to be
created for this webapp. Default value
is "struts-${webapp.name}.war".
-->
<!-- ========== Initialization Properties ================================= -->
<!--
These property values may optionally be overridden with property
settings from an "ant" command line, the "antrc" properties file
in your home directory, or from settings in a superior build.xml
script.
-->
<!-- Should Java compilations set the debug compiler option? -->
<property name="compile.debug" value="true" />
<!-- Should Java compilations set the deprecation compiler option? -->
<property name="compile.deprecation" value="false" />
<!-- Should Java compilations set the optimize compiler option? -->
<property name="compile.optimize" value="true" />
<!-- The base directory for distribution targets -->
<property name="dist.home" value="dist" />
<!-- The base directory for compile targets -->
<property name="target.home" value="target" />
<!-- The source directory for Java compilations related to this webapp -->
<property name="webapp.src" value="src/${webapp.name}" />
<!-- The version number of this particular web application -->
<property name="webapp.version" value="1.0" />
<!-- The name of the web application archive file to be produced -->
<property name="webapp.war" value="${webapp.name}.war" />
<!-- The source directory for copying static web resources and files -->
<property name="webapp.web" value="web/${webapp.name}" />
<!-- ========== Derived Properties ======================================== -->
<!--
These property values are derived from values defined above, and
generally should NOT be overridden by command line settings
-->
<!-- The target directory for building the packed web application -->
<property name="webapp.dist" value="${dist.home}/webapps" />
<!-- The target directory for building the unpacked web application -->
<property name="webapp.target" value="${target.home}/${webapp.name}" />
<!-- The class path used for compiling this library -->
<path id="classpath">
<pathelement location="${servlet.jar}"/>
<pathelement location="${struts.libs}/struts.jar"/>
<pathelement location="${webapp.libs}"/>
<pathelement path="${compile.classpath}"/>
</path>
<!-- ========== Executable Targets ======================================== -->
<!--
The "init" target evaluates "available" expressions as necessary
to modify the behavior of this script.
-->
<target name="init">
<echo message="Processing webapp ${webapp.name}"/>
<!-- Do we need to copy dependent libraries? -->
<available property="copy.libs" file="${webapp.libs}" />
<!-- Do we need to compile the Java sources for this web application? -->
<available property="webapp.compile" file="${webapp.src}" />
<!-- Should we copy Struts library and TLD files? -->
<available property="webapp.struts" file="${struts.libs}" />
</target>
<!--
The "prepare" target creates a directory structure in the build target
area for the unpacked files associated with this web application
-->
<target name="prepare" depends="init"
description="Prepare target directory">
<echo message="Processing webapp ${webapp.name}"/>
<mkdir dir="${webapp.target}" />
<mkdir dir="${webapp.target}/WEB-INF" />
<mkdir dir="${webapp.target}/WEB-INF/classes" />
<mkdir dir="${webapp.target}" />
</target>
<!--
The "libs" target copies specified library JAR files (if any) from the
"${webapp.libs} directory into the WEB-INF/lib directory of this app.
-->
<target name="libs" depends="prepare" if="copy.libs"
description="Copy dependent libraries">
<echo message="Processing webapp ${webapp.name}"/>
<mkdir dir="${webapp.target}/WEB-INF/lib" />
<copy todir="${webapp.target}/WEB-INF/lib">
<fileset dir="${webapp.libs}" includes="*.jar"/>
</copy>
</target>
<!--
The "source" target copies the Java source code of your web application
into the build target area, IF AND ONLY IF the "webapp.source"
property has been set to an arbitrary value.
-->
<target name="source" depends="prepare" if="webapp.compile"
unless="webapp.suppress"
description="Copy Java sources">
<echo message="Processing webapp ${webapp.name}"/>
<mkdir dir="${webapp.target}/WEB-INF/src"/>
<copy todir="${webapp.target}/WEB-INF/src">
<fileset dir="${webapp.src}"/>
</copy>
</target>
<!--
The "struts" target copies the Struts library JAR file and TLDs
into the build target area.
-->
<target name="struts" depends="prepare" if="webapp.struts"
description="Copy Struts library and TLD files">
<echo message="Processing webapp ${webapp.name}"/>
<copy todir="${webapp.target}/WEB-INF">
<fileset dir="${struts.libs}" includes="*.tld"/>
</copy>
<mkdir dir="${webapp.target}/WEB-INF/lib"/>
<copy todir="${webapp.target}/WEB-INF/lib">
<fileset dir="${struts.libs}" includes="*.jar"/>
</copy>
</target>
<!--
The "static" target copies the static web resources portion of your
web application source into the build target area.
-->
<target name="static" depends="prepare,source,libs,struts"
description="Copy static files">
<echo message="Processing webapp ${webapp.name}"/>
<copy todir="${webapp.target}">
<fileset dir="${webapp.web}"/>
</copy>
</target>
<!--
The "compile" target compiles the Java source code of your web
application, if and only if the specified source directory
actually exists.
-->
<target name="compile" depends="static" if="webapp.compile"
description="Compile Java sources">
<echo message="Processing webapp ${webapp.name}"/>
<javac srcdir="${webapp.src}"
destdir="${webapp.target}/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="classpath"/>
</javac>
<copy todir="${webapp.target}/WEB-INF/classes">
<fileset dir="${webapp.src}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<!--
The "dist" target creates a web application archive containing
your completed web application, suitable for deployment on any
compatible servlet container.
-->
<target name="dist" depends="compile"
description="Create web application archive">
<echo message="Processing webapp ${webapp.name}"/>
<delete file="${webapp.dist}/${webapp.war}"/>
<jar jarfile="${webapp.dist}/${webapp.war}"
basedir="${webapp.target}"/>
</target>
<!--
The "clean" task deletes any created directories that have resulted
from running any of the other targets in this script.
-->
<target name="clean"
description="Clean build and distribution directories">
<echo message="Processing webapp ${webapp.name}"/>
<delete dir="${webapp.target}" />
<delete file="${webapp.dist}/${webapp.war}"/>
</target>
</project>
1.1 jakarta-struts/build-webapps.xml
Index: build-webapps.xml
===================================================================
<project name="Struts Web Applications" default="compile" basedir=".">
<!--
This is a build file that creates all of the web applications included
in a Struts distribution, using the generic "build-webapp.xml" script
for the details
-->
<!-- ========== Prerequisite Properties =================================== -->
<!--
These properties MUST be set on the "ant" command line, the "antrc"
properties file in your home directory, or from settings in a superior
build.xml script.
build.home Base directory into which we are building
the Struts components.
compile.classpath If specified, contains a set of JAR files
and/or directories to be added to the
compilation classpath.
servlet.jar The pathname of the servlet API classes
that you wish to compile against.
struts.libs The directory containing struts.jar and
the associated TLD files.
webapp.libs If specified, must be the pathname of a
directory from which all available
"*.jar" files are copied to the web
application's WEB-INF/lib directory.
-->
<property name="servlet.jar" value="../jakarta-servletapi/lib/servlet.jar"/>
<property name="struts.libs" value="target/library"/>
<!-- ========== Initialization Properties ================================= -->
<!--
These property values may optionally be overridden with property
settings from an "ant" command line, the "antrc" properties file
in your home directory, or from settings in a superior build.xml
script.
-->
<!-- Should Java compilations set the debug compiler option? -->
<property name="compile.debug" value="true" />
<!-- Should Java compilations set the deprecation compiler option? -->
<property name="compile.deprecation" value="false" />
<!-- Should Java compilations set the optimize compiler option? -->
<property name="compile.optimize" value="true" />
<!-- The base directory for distribution targets -->
<property name="dist.home" value="dist" />
<!-- The directory into which Struts JAR and TLD files have been created -->
<property name="struts.home" value="target/library" />
<!-- The base directory for compile targets -->
<property name="target.home" value="target" />
<!-- ========== Executable Targets ======================================== -->
<!--
The "static.generic" target causes the "static" target of each
individual web application to be executed.
-->
<target name="static.generic">
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="blank"/>
</ant>
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="documentation"/>
</ant>
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="example"/>
</ant>
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="exercise-taglib"/>
</ant>
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="template-example"/>
</ant>
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="test"/>
</ant>
<ant antfile="build-webapp.xml" target="static">
<property name="webapp.name" value="upload"/>
</ant>
</target>
<!--
The "static" target causes non-generic static activity required
for specific tag libraries to be executed.
-->
<target name="static" depends="static.generic"
description="Copy static resources for individual web applications">
<!-- Copy DTDs for Struts constructs -->
<copy todir="${build.home}/documentation/dtds">
<fileset dir="src/conf" includes="**/*.dtd"/>
</copy>
<!-- Copy required image for the Struts example application -->
<copy tofile="${build.home}/example/struts-power.gif"
file="src/doc/images/struts-power.gif"/>
</target>
<!--
The "compile.generic" target causes the "compile" target of each
individual web application to be executed.
-->
<target name="compile.generic">
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="blank"/>
</ant>
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="documentation"/>
</ant>
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="example"/>
</ant>
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="exercise-taglib"/>
</ant>
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="template-example"/>
</ant>
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="test"/>
</ant>
<ant antfile="build-webapp.xml" target="compile">
<property name="webapp.name" value="upload"/>
</ant>
</target>
<!--
The "compile" target causes non-generic compile activity required
for specific tag libraries to be executed.
-->
<target name="compile" depends="compile.generic"
description="Compile individual web applications">
<!-- Create the taglib documentation -->
<style basedir="src/doc" destdir="${build.home}/documentation"
extension=".html" style="stylesheets/struts.xsl" includes="*.xml"/>
<!-- Create the user guide -->
<style basedir="src/doc/userGuide"
destdir="${build.home}/documentation/userGuide"
extension=".html" style="../stylesheets/userGuide.xsl"
includes="*.xml"/>
<!-- Copy the basic documentation files -->
<copy todir="${build.home}/documentation">
<fileset dir="src/doc">
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.html"/>
<include name="**/*.jpg"/>
<include name="**/*.js"/>
</fileset>
</copy>
<!-- Copy the basic user guide files -->
<copy todir="${build.home}/documentation/userGuide">
<fileset dir="src/doc/userGuide">
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.html"/>
<include name="**/*.jpg"/>
<include name="**/*.js"/>
</fileset>
</copy>
</target>
<!--
The "dist.generic" target causes the "dist" target of each
individual web application to be executed.
-->
<target name="dist.generic">
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="blank"/>
<property name="webapp.war" value="struts-blank.war"/>
</ant>
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="documentation"/>
<property name="webapp.war" value="struts-documentation.war"/>
</ant>
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="example"/>
<property name="webapp.war" value="struts-example.war"/>
</ant>
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="exercise-taglib"/>
<property name="webapp.war" value="struts-exercise-taglib.war"/>
</ant>
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="template-example"/>
<property name="webapp.war" value="struts-template.war"/>
</ant>
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="test"/>
<property name="webapp.war" value="struts-test.war"/>
</ant>
<ant antfile="build-webapp.xml" target="dist">
<property name="webapp.name" value="upload"/>
<property name="webapp.war" value="struts-upload.war"/>
</ant>
</target>
<!--
The "dist" target causes non-generic dist activity required
for specific tag libraries to be executed.
-->
<target name="dist" depends="dist.generic"
description="Create distribution output of web applications">
</target>
<!--
The "clean.generic" target causes the "clean" target of each
individual web application to be executed.
-->
<target name="clean.generic">
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="blank"/>
</ant>
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="documentation"/>
</ant>
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="example"/>
</ant>
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="exercise-taglib"/>
</ant>
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="template-example"/>
</ant>
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="test"/>
</ant>
<ant antfile="build-webapp.xml" target="clean">
<property name="webapp.name" value="upload"/>
</ant>
</target>
<!--
The "clean" target causes non-generic clean activity required
for specific tag libraries to be executed.
-->
<target name="clean" depends="clean.generic"
description="Clean output for individual web applications">
</target>
</project>