| <project name="Struts" default="compile.library" basedir="."> |
| |
| <!-- |
| Struts main build.xml file for building everything related to Struts : |
| - core Struts library |
| - documentation |
| - Struts web apps |
| - run unit tests |
| - ... |
| |
| This script will delegate some of it's tasks to the other build*.xml |
| scripts (build-webapps.xml, build-tests.xml, ...) |
| --> |
| |
| |
| <!-- ========== Prerequisite Properties =================================== --> |
| |
| <!-- |
| These properties MUST be set on the "ant" command line, a |
| "build.properties" file in the base directory, or a |
| "build.properties" file in your user home directory. |
| |
| catalina.home (optional). The path to the Tomcat 4.0 |
| installation. This is required only when |
| executing the "deploy.catalina" target. |
| |
| jdbc20ext.jar (required). The path to the JAR file |
| for the JDBC 2.0 Optional Package APIs. |
| |
| servlet.jar (required). The path to the Servlet API |
| classes to compile against (currently, |
| either version 2.2 or 2.3 supported). |
| |
| tomcat.home (optional). The path to the Tomcat 3.x |
| installation. This is required only when |
| executing the "deploy.tomcat" target. |
| |
| xerces.jar (optional) The path to the Xerces classes |
| to copy. This is required only when |
| executing the "deploy.catalina" target. |
| |
| --> |
| |
| <!-- Load local and user build preferences --> |
| <property file="build.properties"/> |
| <property file="${user.home}/build.properties"/> |
| |
| <!-- Default values for unspecified properties --> |
| <property name="catalina.home" value="../jakarta-tomcat-4.0/build"/> |
| <property name="jdbc20ext.jar" value="../jdbc2_0-stdext.jar"/> |
| <property name="servlet.jar" value="../jakarta-servletapi/lib/servlet.jar"/> |
| <property name="tomcat.home" value="../build/tomcat"/> |
| <property name="xerces.jar" value="../xml-xerces/xerces.jar"/> |
| |
| |
| <!-- ========== Initialization Properties ================================= --> |
| |
| |
| <!-- |
| These property values may optionally be overridden with property |
| settings from an "ant" command line, the "build.properties" file |
| in this directory, the "build.properties" file in your home |
| directory, or from settings in a superior build.xml script. |
| --> |
| |
| <!-- Output directory name for all files generated by the build process --> |
| <property name="build.home" value="target"/> |
| |
| <!-- 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" /> |
| |
| <!-- Name of the core struts library --> |
| <property name="app.name" value="struts"/> |
| |
| <!-- Name of the project --> |
| <property name="project.name" value="jakarta-struts"/> |
| |
| <!-- Version of the project --> |
| <property name="project.version" value="1.0.1"/> |
| |
| |
| <!-- ========== Derived Properties ======================================== --> |
| |
| |
| <!-- |
| These property values are derived from values defined above, and |
| generally should NOT be overridden by command line settings |
| --> |
| |
| <!-- The base directory for distribution targets --> |
| <property name="dist.home" value="dist" /> |
| |
| <!-- Source directory --> |
| <property name="src.dir" value="src"/> |
| |
| <!-- Source directory for core struts library --> |
| <property name="src.share.dir" value="${src.dir}/share"/> |
| |
| <!-- Directory where core struts library configurations files are stored --> |
| <property name="conf.share.dir" value="conf/share"/> |
| |
| <!-- Directory where test configurations files are stored --> |
| <property name="conf.test.dir" value="conf/test"/> |
| |
| <!-- Doc directory --> |
| <property name="doc.dir" value="doc"/> |
| |
| <!-- Web directory --> |
| <property name="web.dir" value="web"/> |
| |
| <!-- Compilation Classpath --> |
| <path id="compile.classpath"> |
| <pathelement location="${jdbc20ext.jar}"/> |
| <pathelement location="${servlet.jar}"/> |
| </path> |
| |
| |
| <!-- ========== Executable Targets ======================================== --> |
| |
| |
| <!-- |
| The "init" target evaluates "available" expressions as necessary |
| to modify the behavior of this script and print some information on |
| screen |
| --> |
| <target name="init"> |
| |
| <echo message="--------- ${project.name} ${project.version} ---------"/> |
| <echo message=""/> |
| |
| <echo message="java.class.path = ${java.class.path}"/> |
| <echo message="java.home = ${java.home}"/> |
| <echo message="user.home = ${user.home}"/> |
| |
| </target> |
| |
| <!-- |
| Create directories and copy files for the core struts library |
| --> |
| <target name="prepare.library" depends="init"> |
| <mkdir dir="${build.home}/library/classes/META-INF"/> |
| <copy file="LICENSE" |
| tofile="${build.home}/library/classes/META-INF/LICENSE.txt"/> |
| <mkdir dir="${build.home}/library/classes/META-INF/tlds"/> |
| <copy file="${conf.share.dir}/struts.tld" |
| tofile="${build.home}/library/classes/META-INF/taglib.tld"/> |
| <mkdir dir="${build.home}/library/classes/org/apache/struts/resources"/> |
| <copy todir="${build.home}/library/classes/org/apache/struts/resources"> |
| <fileset dir="${conf.share.dir}" includes="**/*.dtd"/> |
| </copy> |
| <copy file="${jdbc20ext.jar}" |
| tofile="${build.home}/library/jdbc2_0-stdext.jar"/> |
| </target> |
| |
| <!-- |
| Prepare static directories for web applications |
| --> |
| <target name="static.webapps"> |
| <ant antfile="build-webapps.xml" target="static"/> |
| </target> |
| |
| <!-- |
| Compile core struts library directory components |
| --> |
| <target name="compile.library" depends="prepare.library" |
| description="Compile Struts library files"> |
| <javac srcdir="${src.share.dir}" |
| destdir="${build.home}/library/classes" |
| debug="${compile.debug}" |
| optimize="${compile.optimize}" |
| deprecation="${compile.deprecation}"> |
| <classpath refid="compile.classpath"/> |
| </javac> |
| <copy todir="${build.home}/library/classes"> |
| <fileset dir="${src.share.dir}" includes="**/*.properties"/> |
| </copy> |
| <copy todir="${build.home}/library"> |
| <fileset dir="${conf.share.dir}" includes="*.dtd"/> |
| <fileset dir="${conf.share.dir}" includes="*.tld"/> |
| </copy> |
| <style basedir="${doc.dir}" |
| destdir="${build.home}/library" |
| extension=".tld" |
| style="stylesheets/tld.xsl" |
| includes="struts-*.xml"/> |
| <copy todir="${build.home}/library/classes/META-INF/tlds"> |
| <fileset dir="${build.home}/library" includes="struts-*.tld"/> |
| </copy> |
| <jar jarfile="${build.home}/library/${app.name}.jar" |
| manifest="${conf.share.dir}/MANIFEST.MF" |
| basedir="${build.home}/library/classes" |
| includes="**"/> |
| </target> |
| |
| <!-- |
| Compile code for web applications |
| --> |
| <target name="compile.webapps" depends="compile.library,static.webapps" |
| description="Compile Struts web applications"> |
| <ant antfile="build-webapps.xml" target="compile"/> |
| </target> |
| |
| <!-- |
| Create Javadoc documentation |
| --> |
| <target name="compile.javadoc" |
| description="Generate JavaDoc API docs"> |
| <delete dir="${build.home}/documentation/api"/> |
| <mkdir dir="${build.home}/documentation/api"/> |
| <javadoc sourcepath="${src.share.dir}" |
| destdir="${build.home}/documentation/api" |
| classpath="${servlet.jar}:${jdbc20ext.jar}" |
| packagenames="org.apache.struts.*" |
| author="true" |
| private="true" |
| version="true" |
| windowtitle="Apache Struts API Documentation" |
| doctitle="<h1>Apache Struts Framework (Version ${project.version})</h1>" |
| bottom="Copyright © 2000-2001 - Apache Software Foundation"/> |
| </target> |
| |
| <!-- |
| Create directories and copy files for distribution |
| --> |
| <target name="prepare.dist" depends="init"> |
| <mkdir dir="${dist.home}"/> |
| <mkdir dir="${dist.home}/lib"/> |
| <mkdir dir="${dist.home}/webapps"/> |
| </target> |
| |
| <!-- |
| Construct library distributables |
| --> |
| <target name="dist.library" depends="prepare.dist,compile.library"> |
| <copy todir="${dist.home}/lib"> |
| <fileset dir="${build.home}/library" includes="*.dtd"/> |
| <fileset dir="${build.home}/library" includes="*.jar"/> |
| <fileset dir="${build.home}/library" includes="*.tld"/> |
| </copy> |
| </target> |
| |
| <!-- |
| Construct distributable web applications |
| --> |
| <target name="dist.webapps" depends="compile.webapps,compile.javadoc"> |
| <ant antfile="build-webapps.xml" target="dist"/> |
| </target> |
| |
| <!-- |
| Copy sources for distribution |
| --> |
| <target name="dist.source" depends="prepare.dist"> |
| <copy file="INSTALL" tofile="${dist.home}/INSTALL"/> |
| <copy file="LICENSE" tofile="${dist.home}/LICENSE"/> |
| <copy file="README" tofile="${dist.home}/README"/> |
| </target> |
| |
| <!-- |
| Construct complete release distribution |
| --> |
| <target name="dist" depends="dist.library,dist.webapps,dist.source" |
| description="Construct binary distribution"/> |
| |
| <!-- |
| Deploy these applications on Catalina |
| --> |
| <target name="deploy.catalina" depends="compile.webapps" |
| description="Deploy Struts web.apps in Catalina (Tomcat 4.0)"> |
| |
| <mkdir dir="${catalina.home}/webapps/struts-blank"/> |
| <copy todir="${catalina.home}/webapps/struts-blank"> |
| <fileset dir="${build.home}/blank"/> |
| </copy> |
| <copy todir="${catalina.home}/webapps/struts-blank/WEB-INF/lib" |
| file="${xerces.jar}"/> |
| |
| <mkdir dir="${catalina.home}/webapps/struts-documentation"/> |
| <copy todir="${catalina.home}/webapps/struts-documentation"> |
| <fileset dir="${build.home}/documentation"/> |
| </copy> |
| |
| <mkdir dir="${catalina.home}/webapps/struts-example"/> |
| <copy todir="${catalina.home}/webapps/struts-example"> |
| <fileset dir="${build.home}/example"/> |
| </copy> |
| <copy todir="${catalina.home}/webapps/struts-example/WEB-INF/lib" |
| file="${xerces.jar}"/> |
| |
| <mkdir dir="${catalina.home}/webapps/struts-template"/> |
| <copy todir="${catalina.home}/webapps/struts-template"> |
| <fileset dir="${build.home}/template-example"/> |
| </copy> |
| <copy todir="${catalina.home}/webapps/struts-template/WEB-INF/lib" |
| file="${xerces.jar}"/> |
| |
| <mkdir dir="${catalina.home}/webapps/struts-exercise-taglib"/> |
| <copy todir="${catalina.home}/webapps/struts-exercise-taglib"> |
| <fileset dir="${build.home}/exercise-taglib"/> |
| </copy> |
| <copy todir="${catalina.home}/webapps/struts-exercise-taglib/WEB-INF/lib" |
| file="${xerces.jar}"/> |
| |
| <mkdir dir="${catalina.home}/webapps/struts-upload"/> |
| <copy todir="${catalina.home}/webapps/struts-upload"> |
| <fileset dir="${build.home}/upload"/> |
| </copy> |
| <copy todir="${catalina.home}/webapps/struts-upload/WEB-INF/lib" |
| file="${xerces.jar}"/> |
| |
| </target> |
| |
| <!-- |
| Deploy these applications on Tomcat |
| --> |
| <target name="deploy.tomcat" depends="compile.webapps" |
| description="Deploy Struts web.apps in Tomcat 3.x"> |
| |
| <mkdir dir="${tomcat.home}/webapps/struts-blank"/> |
| <copy todir="${tomcat.home}/webapps/struts-blank"> |
| <fileset dir="${build.home}/blank"/> |
| </copy> |
| |
| <mkdir dir="${tomcat.home}/webapps/struts-documentation"/> |
| <copy todir="${tomcat.home}/webapps/struts-documentation"> |
| <fileset dir="${build.home}/documentation"/> |
| </copy> |
| |
| <mkdir dir="${tomcat.home}/webapps/struts-example"/> |
| <copy todir="${tomcat.home}/webapps/struts-example"> |
| <fileset dir="${build.home}/example"/> |
| </copy> |
| |
| <mkdir dir="${tomcat.home}/webapps/struts-template"/> |
| <copy todir="${tomcat.home}/webapps/struts-template"> |
| <fileset dir="${build.home}/template-example"/> |
| </copy> |
| |
| <mkdir dir="${tomcat.home}/webapps/struts-exercise-taglib"/> |
| <copy todir="${tomcat.home}/webapps/struts-exercise-taglib"> |
| <fileset dir="${build.home}/exercise-taglib"/> |
| </copy> |
| |
| <mkdir dir="${tomcat.home}/webapps/struts-upload"/> |
| <copy todir="${tomcat.home}/webapps/struts-upload"> |
| <fileset dir="${build.home}/upload"/> |
| </copy> |
| |
| </target> |
| |
| <!-- |
| Clean up build and distribution directories |
| --> |
| <target name="clean" |
| description="Clean build and distribution directories"> |
| <delete dir="${build.home}"/> |
| <delete dir="${dist.home}"/> |
| </target> |
| |
| <!-- |
| All-in-one build target |
| --> |
| <target name="all" depends="clean,compile.library,compile.webapps" |
| description="Clean and build library and web applications"/> |
| |
| <!-- |
| Run tests on all servers not commented out in the build.properties file. |
| --> |
| <target name="test.all" depends="test.tomcat.32,test.tomcat.40" |
| description="Run unit tests on all servlet engines"> |
| </target> |
| |
| <!-- |
| Display a warning message if the needed servlet engine home property |
| is not set (for Tomcat 3.2) |
| --> |
| <target name="check.tests.tomcat.32" depends="compile.library" unless="tomcat.home.32"> |
| |
| <echo message=""/> |
| <echo message="*********************************************************"/> |
| <echo message="WARNING : The 'tomcat.home.32' property has not been set."/> |
| <echo message=" No test will be run on that servlet engine."/> |
| <echo message="*********************************************************"/> |
| <echo message=""/> |
| |
| </target> |
| |
| <!-- |
| Run the Struts unit tests in the Tomcat 3.2 servlet engine |
| --> |
| <target name="test.tomcat.32" depends="check.tests.tomcat.32,compile.library" |
| if="tomcat.home.32" description="Run unit tests on Tomcat 3.2"> |
| |
| <echo message="tomcat.home.32 = ${tomcat.home.32}"/> |
| <ant antfile="build-tests.xml" target="test.tomcat.32"/> |
| |
| </target> |
| |
| <!-- |
| Display a warning message if the needed servlet engine home property |
| is not set (for Tomcat 4) |
| --> |
| <target name="check.tests.tomcat.40" depends="compile.library" unless="tomcat.home.40"> |
| |
| <echo message=""/> |
| <echo message="*********************************************************"/> |
| <echo message="WARNING : The 'tomcat.home.40' property has not been set."/> |
| <echo message=" No test will be run on that servlet engine."/> |
| <echo message="*********************************************************"/> |
| <echo message=""/> |
| |
| </target> |
| |
| <!-- |
| Run the Struts unit tests in the Tomcat 4.0 servlet engine |
| --> |
| <target name="test.tomcat.40" depends="check.tests.tomcat.40,compile.library" |
| if="tomcat.home.40" description="Run unit tests on Tomcat 4.0"> |
| |
| <echo message="tomcat.home.40 = ${tomcat.home.40}"/> |
| <ant antfile="build-tests.xml" target="test.tomcat.40"/> |
| |
| </target> |
| |
| </project> |