You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2003/02/20 21:08:34 UTC

cvs commit: xml-cocoon2 blocks.properties build.old.xml build.properties BUILD.txt .cvsignore build.bat build.xml project-info.xml

stefano     2003/02/20 12:08:33

  Modified:    .        .cvsignore build.bat build.xml project-info.xml
  Added:       .        blocks.properties build.old.xml build.properties
                        BUILD.txt
  Log:
  the new build system
  
  Revision  Changes    Path
  1.10      +3 -5      xml-cocoon2/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/.cvsignore,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- .cvsignore	2 Jan 2003 10:50:05 -0000	1.9
  +++ .cvsignore	20 Feb 2003 20:08:21 -0000	1.10
  @@ -1,10 +1,8 @@
  -
  -.ant.properties
   build
  -cocoon.sampledata
   dist
   prj.el
  -tools/anttasks
  -javadoc*
   .project
   .classpath
  +local.build.properties
  +local.blocks.properties
  +cocoon.sampledata
  
  
  
  1.21      +2 -2      xml-cocoon2/build.bat
  
  Index: build.bat
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/build.bat,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- build.bat	3 Dec 2002 00:11:23 -0000	1.20
  +++ build.bat	20 Feb 2003 20:08:21 -0000	1.21
  @@ -32,7 +32,7 @@
   set OLD_ANT_HOME=%ANT_HOME%
   set ANT_HOME=tools
   
  -call %ANT_HOME%\bin\ant %1 %2 %3 %4 %5 %6 %7 %8 %9
  +call %ANT_HOME%\bin\ant -logger org.apache.tools.ant.NoBannerLogger -emacs %1 %2 %3 %4 %5 %6 %7 %8 %9
   
   rem ----- Restore ANT_HOME
   set ANT_HOME=%OLD_ANT_HOME%
  
  
  
  1.320     +615 -2181 xml-cocoon2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/build.xml,v
  retrieving revision 1.319
  retrieving revision 1.320
  diff -u -r1.319 -r1.320
  --- build.xml	7 Feb 2003 13:17:14 -0000	1.319
  +++ build.xml	20 Feb 2003 20:08:22 -0000	1.320
  @@ -1,948 +1,226 @@
   <!-- ===========================================================================
   
  -
                          * =========================== *
                          |  Apache Cocoon Build System |
                          * =========================== *
   
  -                                     by
  -
  -                     Stefano Mazzocchi <st...@apache.org>
  -                     Carsten Ziegeler <cz...@apache.org>
  -
  -
  -Installing the build tools
  -==========================
  -
  -The Cocoon build system is based on Apache Ant, which is a Java building tool
  -originally developed for the Tomcat project but now used in many other
  -Apache projects and extended by many developers.
  -
  -Ant is a little but very handy tool that uses a build file written in XML
  -(this file) as building instructions. For more information refer to
  -"http://jakarta.apache.org/ant/".
  -
  -To make things easier for you, the Cocoon distribution contains a precompiled
  -version of Ant and the build scripts take care of running it.
  -
  -The only thing that you have to make sure, is the "JAVA_HOME" environment
  -property should be set to match the JVM you want to use.
  -
  -That's all you have to do to be ready to go.
  -
  -
  -Building instructions
  -=====================
  -
  -Ok, let's build the baby. First, make sure your current working directory is
  -where this very file is located. Then type
  -
  -  ./build.sh (unix)
  -  .\build.bat (win32)
  -
  -if everything is right and all the required packages are visible, this action
  -will generate a file called "cocoon.jar" in the "./build/cocoon" directory.
  -Note, that if you do further development, compilation time is reduced since
  -Ant is able of detecting which files have changed and to recompile them at need.
  -
  -Also, you'll note that reusing a single JVM instance for each task, increases
  -tremendously the performance of the whole build system, compared to other
  -tools (i.e. make or shell scripts) where a new JVM is started for each task.
  -
  -
  -Building on another directory
  -=============================
  -
  -Sometimes you might want to build on an external directory to keep the
  -distribution clean: no worries, this is just an environment property away.
  -Suppose you want to use the "../build" directory instead, you simply tipe
  -
  - [unix]  ./build.sh  -Dbuild.root=../build
  - [win32] .\build.bat -Dbuild.root=..\build
  -
  -By using the -Dxxx=yyy argument, you are setting environments in the JVM: Ant
  -is designed to give higher priority to system environments to allow you to
  -modify _any_ <property> that you can find in the building instructions below,
  -so it's just a matter of understanding what property you want to change
  -and you don't have to touch this file (which you shouldn't need to do).
  -
  -
  -Build targets
  -=============
  -
  -The build system is not only responsible of compiling Cocoon into a jar file,
  -but is also responsible for creating the HTML documentation, javadocs,
  -distributions and web site. In fact, the file you have here is _exactly_ what
  -is used by cocoon maintainers to take care of everything in the Cocoon
  -project, no less and no more.
  -
  -To know more about the available targets take a look at this file, which is
  -pretty self-explanatory or type
  -
  - [unix]  ./build.sh  -projecthelp
  - [win32] .\build.bat -projecthelp
  -
  -and concentrate on the target descriptions that start with a star '*': these
  -are the one you should call, the others are internal targets that are called
  -by the main ones.
  -
  -Build Dependencies
  -==================
  -Some components are optional and require special jar files to be compiled
  -and added to the web application. Some if these jars are already included
  -in the distribution while others not.
  -For each optional package which is not available, a warning is
  -printed. If you don't like these warnings, specify the property "omit.opt.warnings"
  -(build -Domit.opt.warnings).
  -
  -
  -                              Happy hacking from the Apache Cocoon Dev Team :)
  -
  -CVS: $Id$:
  +       CVS: $Id$:
   
   ============================================================================ -->
   
  -<project default="all" basedir="." name="Apache Cocoon">
  +<project default="package" basedir="." name="Apache Cocoon">
  +
  +<!-- Initialization Targets ================================================ -->
   
  -  <!--
  -    Give user a chance to override without editing this file
  -    (and without typing -D each time he compiles it)
  -  -->
  -  <property file=".ant.properties"/>
  -  <property file="${user.home}/.ant.properties"/>
  -
  -  <!--
  -    these are here only for those who use jikes @namer. For other
  -    developers this part makes no difference.
  -  -->
  -  <property name="build.compiler.emacs" value="on"/>
  -  <!-- property name="build.compiler.warnings" value="true"/ -->
  -  <property name="build.compiler.pedantic" value="false"/>
  -  <property name="build.compiler.depend" value="true"/>
  -  <property name="build.compiler.fulldepend" value="true"/>
  -
  -  <!-- =================================================================== -->
  -  <!-- Initialization target                                               -->
  -  <!-- =================================================================== -->
     <target name="init">
   
  +    <!-- Set the timestamps -->
       <tstamp/>
   
       <!-- Detecting the current jvm -->
       <condition property="target.vm" value="1.4">
  -      <equals arg1="1.4" arg2="${java.specification.version}"/>
  +      <equals arg1="1.4" arg2="${ant.java.version}"/>
       </condition>
       <condition property="target.vm" value="1.2">
         <not>
  -        <equals arg1="1.4" arg2="${java.specification.version}"/>
  +        <equals arg1="1.4" arg2="${ant.java.version}"/>
         </not>
       </condition>
   
  -    <!-- =================================================================== -->
  -    <!-- Identify Classpath                                                 -->
  -    <!-- =================================================================== -->
  +    <!-- The location of tools.jar, relative to the JAVA_HOME home. -->
  +    <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
  +    <available file="${tools.jar}" property="tools.jar.present"/>
  +
  +    <!-- Allow users a chance to override without editing the main file -->
  +    <property file="${user.home}/cocoon.build.properties"/>
  +    <property file="local.build.properties"/>
  +
  +    <!-- Get the build properties from an external file -->
  +    <property file="build.properties"/>
  +
  +    <!-- Allow users a chance to override without editing the main file -->
  +    <property file="${user.home}/cocoon.blocks.properties"/>
  +    <property file="local.blocks.properties"/>
  +
  +    <!-- Get the block properties from an external file -->
  +    <property file="blocks.properties"/>
  +
  +    <filter token="Name"                value="${fullname}"/>
  +    <filter token="name"                value="${fullname}"/>
  +    <filter token="year"                value="${year}"/>
  +    <filter token="version"             value="${version}"/>
  +    <filter token="date"                value="${TODAY}"/>
  +    <filter token="released.version"    value="${released.version}"/>
  +
  +    <!-- Set classpath -->
       <path id="classpath">
  -      <fileset dir="./lib/local">
  +      <fileset dir="${lib}">
           <include name="*.jar"/>
         </fileset>
  -      <fileset dir="./lib/endorsed">
  +      <fileset dir="${lib.endorsed}">
           <include name="*.jar"/>
  -      </fileset>      
  -      <fileset dir="./lib/core">
  +      </fileset>
  +      <fileset dir="${lib.core}">
           <include name="*.jar"/>
         </fileset>
  -      <fileset dir="./lib/core/jvm${target.vm}">
  +      <fileset dir="${lib.core}/jvm${target.vm}">
           <include name="*.jar"/>
         </fileset>
  -      <fileset dir="./lib/optional">
  +      <fileset dir="${lib.optional}">
           <include name="*.jar"/>
         </fileset>
  +      <path location="${build.mocks}"/>
  +      <path location="${build.dest}"/>
       </path>
   
  -    <path id="anttasks.classpath">
  -      <fileset dir="./lib/local">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./lib/endorsed">
  -        <include name="*.jar"/>
  -      </fileset>      
  -      <fileset dir="./lib/core">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./lib/core/jvm${target.vm}">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./lib/optional">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./tools/lib">
  +    <!-- Set classpath for building ant tasks -->
  +    <path id="tasks.classpath">
  +      <path refid="classpath"/>
  +      <fileset dir="${tools.lib}">
           <include name="*.jar"/>
         </fileset>
  +      <path location="${tools.tasks}"/>
       </path>
   
  +    <!-- Set classpath for scratchpad -->
       <path id="scratchpad.classpath">
  -      <fileset dir="./lib/local">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./lib/endorsed">
  -        <include name="*.jar"/>
  -      </fileset>      
  -      <fileset dir="./lib/core">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./lib/core/jvm${target.vm}">
  -        <include name="*.jar"/>
  -      </fileset>
  -      <fileset dir="./lib/optional">
  -        <include name="*.jar"/>
  -      </fileset>
  +      <path refid="classpath"/>
         <fileset dir="./src/scratchpad/lib">
           <include name="*.jar"/>
         </fileset>
  -      <!-- FIXME : how to build a path that references a property set in 'init' target ? -->
  -      <!-- NKB use the top-level tasks in Ant 1.5.1+ -->
  -      <pathelement path="./build/cocoon/classes"/>
       </path>
   
  -    <!-- =================================================================== -->
  -    <!-- Properties                                                          -->
  -    <!-- =================================================================== -->
  -
  -    <dirname property="antfile.dir" file="${ant.file}"/>
  -  
  -    <!-- Get the properties from the properties.xml file -->
  -    <xmlproperty file="properties.xml"
  -                 keeproot="false" 
  -                 collapseAttributes="true" />
  -    <condition property="validate.config">
  -      <istrue value="${build.validate.config}"/>
  -    </condition>
  -    <condition property="validate.xdocs">
  -      <istrue value="${build.validate.xdocs}"/>
  -    </condition>
  -
  -    <echo message="--------------------------------------------------------------"/>
  -    <echo message="            ${fullname} ${version} [${year}]                  "/>
  -    <echo message="--------------------------------------------------------------"/>
  -    <echo message="Building with ${ant.version}"/>
  -    <echo message="using build file ${ant.file}"/>
  -    <echo message="--------------------------------------------------------------"/>
  -    <echo message=" WARNING:                                                     "/>
  -    <echo message="   This build is targeted for use with JVM ${target.vm}"/>
  -    <echo message="                                                              "/>
  -    <echo message="   Using this build on a virtual machine other than the one   "/>
  -    <echo message="   it is targeted for may result in runtime errors.          "/>
  -    <echo message="                                                              "/>
  -    <echo message="--------------------------------------------------------------"/>
  -
  -    <!-- The location of tools.jar, relative to the JAVA_HOME home. -->
  -    <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
  -    <available file="${tools.jar}" property="tools.jar.present"/>
  -
  -    <filter token="Name"    value="${fullname}"/>
  -    <filter token="name"    value="${fullname}"/>
  -    <filter token="year"    value="${year}"/>
  -    <filter token="version" value="${version}"/>
  -    <filter token="date"    value="${TODAY}"/>
  -    <filter token="log"     value="true"/>
  -    <filter token="verbose" value="true"/>
  -    <filter token="released.version" value="${released.version}"/>
  -    <filter token="install.war" value="${install.war}"/>
  -
  -    <!-- Add filters for loading database information  -->
  -    <filter token="database-driver" value="${cocoon.samples.database.driver}"/>
  -    <filter token="database-url" value="${cocoon.samples.database.url}"/>
  -    <filter token="database-user" value="${cocoon.samples.database.user}"/>
  -    <filter token="database-password" value="${cocoon.samples.database.password}"/>
  -
  -    <!-- Use Jing for XML validation with RELAX NG -->
  -    <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
  -      <classpath refid="anttasks.classpath"/>
  -    </taskdef>
  +    <!-- Build and prepare the cocoon-specific ant tasks =================== -->
   
  -    <!-- Add ant-contrib tasks -->
  -    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  - 
       <!-- compile the ant tasks -->
  -    <mkdir dir="${tools.dir}/anttasks"/>
  -    <javac srcdir="${tools.dir}/src" 
  -           destdir="${tools.dir}/anttasks"
  +    <mkdir dir="${tools.tasks}"/>
  +    <javac srcdir="${tools.src}"
  +           destdir="${tools.tasks}"
              debug="off"
              optimize="on"
              deprecation="on"
  -           target="1.2"
  +           target="${target.vm}"
              nowarn="on"
  -           classpathref="anttasks.classpath"
  -           fork="true"/>
  -  </target>
  +           compiler="${compiler}"
  +           classpathref="tasks.classpath"/>
   
  -  <!-- =================================================================== -->
  -  <!-- Interactive build                                                   -->
  -  <!-- =================================================================== -->
  -  <target name="i" description="Interactive Build" depends="interactive"/>
  -    
  -  <target name="interactive" description="Interactive Build">
  -    <echo message=" "/>   
  -    <echo message="--------------------------------------------------------------"/>
  -    <echo message=" "/>    
  -    <echo message="                        APACHE COCOON "/>
  -    <echo message=" "/>     
  -    <echo message="--------------------------------------------------------------"/>
  -    <echo message="Building with ${ant.version}"/>
  -    <echo message="using build file ${ant.file}"/>
  -    <echo message="--------------------------------------------------------------"/>
  -    <echo message=" "/>    
  -    <echo message=" These are the most common build targets."/>
  -    <echo message=" You can also invoke them directly; see build.xml for more info. "/>
  -    <echo message=" "/>
  -    <echo message=" installwar ------ installs war package"/>
  -    <echo message=" installscratchpadwar --- also with scratchpad stuff"/>
  -    <echo message=" docs ------------ generates the docs"/>
  -    <echo message=" validate-xdocs -- validation of all core XML documentation"/>
  -    <echo message=" javadocs -------- generates the API documentation"/>
  -    <echo message=" printer-docs ---- generates the printer friendly docs"/>
  -    <echo message=" test ------------ performes all the tests"/>
  -    <echo message=" compile --------- compiles the source code "/>
  -    <echo message=" webapp-local ---- local webapp context dir for quick turn around"/>    
  -    <echo message=" clean ----------- cleans the build directory"/>
  -    <echo message=" "/>
  -    <echo message=" "/>
  -    
  -    <!-- Ask the user for the destination path for the war -->
  -    <input message="Please select a target"
  -           addproperty="input.selection"/>
  -
  -    <!-- If he hits enter, abort -->
  -    <condition property="do.abort">
  -      <equals arg1="" arg2="${input.selection}" />
  -    </condition>
  -    <fail if="do.abort">Build aborted by user.</fail>
  -    
  -    <antcall target="${input.selection}"/>
  -  </target>
  -  
  -  <!-- =================================================================== -->
  -  <!-- Try other builds that could go into this core build                 -->
  -  <!-- =================================================================== -->
  -  <target name="try" depends="init">
  -    <ant target="${try.task}" antfile="build-t.xml"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Installs Cocoon war file in a specified directory                   -->
  -  <!-- =================================================================== -->
  -  <target name="installwar" depends="init"
  -          description="Installs the WAR package (without the scratchpad) in a specified directory">
  -
  -    <!-- Ask the user for the destination path for the war -->
  -    <input message="Please select an installation directory"
  -           addproperty="install.war"/>
  -
  -    <!-- If he hits enter, abort -->
  -    <condition property="do.abort">
  -       <equals arg1="" arg2="${install.war}" />
  -    </condition>
  -    <fail if="do.abort">Build aborted by user.</fail>
  +    <!-- A task to patch xml files -->
  +    <taskdef name="xpatch" classname="XConfToolTask">
  +      <classpath refid="tasks.classpath"/>
  +    </taskdef>
   
  -    <!-- call install target -->
  -    <antcall target="install"/>
  -  </target>
  -        
  -  <!-- =================================================================== -->
  -  <!-- Installs Cocoon war with scratchpad stuff in a specified directory  -->
  -  <!-- =================================================================== -->
  -  <target name="installscratchpadwar" depends="init"
  -          description="Installs the WAR package (with the scratchpad) in a specified directory">
  -    <echo message=" This contains SCRATCHPAD BUILDS. It is not guaranteed to work."/>
  -    <echo message=" You have been warned. "/>
  -  
  -    <!-- Ask the user for the destination path for the war -->
  -    <input message="Please select an installation directory"
  -           addproperty="install.war"/>
  -
  -    <!-- If he hits enter, abort -->
  -    <condition property="do.abort">
  -      <equals arg1="" arg2="${install.war}" />
  -    </condition>
  -    <fail if="do.abort">Build aborted by user.</fail>
  -    
  -    <!-- call install target -->
  -    <antcall target="install"/>
  +    <!-- Use Jing for XML validation with RELAX NG -->
  +    <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
  +      <classpath refid="tasks.classpath"/>
  +    </taskdef>
     </target>
   
  -  
  -  <!-- =================================================================== -->
  -  <!-- Test for optional components                                        -->
  -  <!-- =================================================================== -->
  +  <!-- Test for optional components -->
     <target name="optional-tests" depends="init">
  -    <echo message="Testing for optional components"/>
  -
       <available classpathref="classpath"
  -               property="jaxen.present" 
  -               classname="org.jaxen.dom.XPath"/>
  -
  -    <available classpathref="classpath"
  -               property="ifx.driver.present" 
  +               property="ifx.driver.present"
                  classname="com.informix.jdbc.IfxResultSet"/>
   
       <available classpathref="classpath"
  -               property="poi.proper.present" 
  -               classname="org.apache.poi.poifs.common.POIFSConstants"/>
  -                    
  -    <available classpathref="classpath"
  -               property="commons.logging.present" 
  -               classname="org.apache.commons.logging.LogFactory"/>     
  -                    
  -    <condition property="poi.present">
  -     <and> <!-- with post 1.4.1 Ant use <isset property="poi.proper.present"/> -->
  -      <not>
  -        <equals arg1="${poi.proper.present}" arg2="$${poi.proper.present}" />
  -      </not>
  -      <not> <!-- with post 1.4.1 Ant use <isset property="commons.logging.present"/> -->
  -        <equals arg1="${commons.logging.present}" arg2="$${commons.logging.present}" />
  -      </not>
  -     </and>
  -    </condition>
  -    
  -    <available classpathref="classpath"
  -               property="pizza.present" 
  -               classname="net.sf.pizzacompiler.compiler.Main"/>
  -
  -    <available classpathref="classpath" 
  -               property="xmldb.present" 
  -               classname="org.xmldb.api.DatabaseManager"/>
  -
  -    <available classpathref="classpath" 
  -               property="xindice.present" 
  -               classname="org.apache.xindice.client.xmldb.DatabaseImpl"/>
  -
  -    <available classpathref="classpath" 
  -               property="jfor.present" 
  -               classname="org.jfor.jfor.converter.Converter"/>
  -
  -    <available classpathref="classpath" 
  -               property="servlet.present" 
  -               classname="javax.servlet.http.HttpServlet"/>
  -
  -    <available classpathref="classpath" 
  -               property="servlet23.present" 
  +               property="servlet23.present"
                  classname="javax.servlet.http.HttpServletRequestWrapper"/>
   
       <available classpathref="classpath"
  -               property="bsf.present" 
  -               classname="com.ibm.bsf.BSFException"/>
  -
  -    <available classpathref="classpath"
  -               property="rhino.compiler.present" 
  -               classname="org.mozilla.javascript.tools.jsc.Main"/>
  -
  -    <available classpathref="classpath"
  -               property="rhino.interpreter.present" 
  -               classname="org.mozilla.javascript.Context"/>
  -
  -    <available classpathref="classpath"
  -               property="python.present" 
  -               classname="org.python.core.Py"/>
  +               property="mail.present"
  +               classname="javax.mail.Flags"/>
   
       <available classpathref="classpath"
  -               property="jstyle.present" 
  -               classname="jstyle.JSFormatter"/>
  +               property="jxpath.present"
  +               classname="org.apache.commons.jxpath.JXPathContext"/>
   
       <available classpathref="classpath"
  -               property="xpath.present" 
  -               classname="org.apache.xpath.XPathAPI"/>
  +               property="activation.present"
  +               classname="javax.activation.DataSource"/>
  +  </target>
   
  -    <available classpathref="classpath"
  -               property="deli.present" 
  -               classname="com.hp.hpl.deli.Profile"/>
  +<!-- Preparation Targets =================================================== -->
   
  -    <available classpathref="classpath"
  -               property="velocity.present" 
  -               classname="org.apache.velocity.app.Velocity"/>
  +  <!-- Prepare everything -->
  +  <target name="prepare" depends="prepare-core, prepare-deprecated, prepare-scratchpad, prepare-samples">
  +    <echo>+-------------------------------------------------------------------------------+</echo>
  +    <echo>                        ${fullname} ${version} [${year}]</echo>
  +    <echo>+-------------------------------------------------------------------------------+</echo>
  +    <echo> Building with ${ant.version}</echo>
  +    <echo> using build file ${ant.file}</echo>
  +    <echo> Compiling with debug ${compiler.debug}, optimize ${compiler.optimize}, deprecation ${compiler.deprecation}</echo>
  +    <echo>+-----------------------------| W A R N I N G |---------------------------------+</echo>
  +    <echo>               This build is targeted for use with JVM ${target.vm}</echo>
  +    <echo>          Using this build on a virtual machine other than the one</echo>
  +    <echo>             it is targeted for may result in runtime errors.</echo>
  +    <echo>+-------------------------------------------------------------------------------+</echo>
  +  </target>
  +
  +  <!-- Prepare the build directory -->
  +  <target name="prepare-build" depends="init">
  +    <mkdir dir="${build}"/>
  +  </target>
  +
  +  <!-- Prepare the source -->
  +  <!-- [FIXME] dependency on 'prepare-deprecated' should be removed once dependencies on deprecated code are removed -->
  +  <target name="prepare-core" depends="generate-code,prepare-deprecated">
  +    <mkdir dir="${build.src}"/>
  +    <mkdir dir="${build.dest}"/>
  +    <copy todir="${build.src}" filtering="on">
  +      <fileset dir="${java}"/>
  +    </copy>
  +  </target>
   
  -    <available classpathref="classpath"
  -               property="resolver.present" 
  -               classname="org.apache.xml.resolver.Resolver"/>
  +  <!-- Set a variable if the generated java code is already up-to-date. -->
  +  <target name="generate-code-check" depends="prepare-build">
  +    <uptodate property="generate-code.notrequired"
  +        targetfile="${build.src}/org/apache/cocoon/components/browser/BrowserImpl.java" >
  +      <srcfiles dir="${java}/org/apache/cocoon/components/browser"
  +          includes="BrowserImpl.xml,BrowserImpl.xsl"/>
  +    </uptodate>
  +  </target>
   
  -    <available classpathref="classpath"
  -               property="ora.driver.present" 
  -               classname="oracle.jdbc.OracleResultSet"/>
  +  <!-- Generate the Java code from XML using XSLT  -->
  +  <target name="generate-code" depends="generate-code-check"
  +          unless="generate-code.notrequired">
  +    <xslt basedir="${java}/org/apache/cocoon/components/browser"
  +           destdir="${build.src}/org/apache/cocoon/components/browser"
  +           includes="BrowserImpl.xml"
  +           extension=".java"
  +           style="${java}/org/apache/cocoon/components/browser/BrowserImpl.xsl"/>
  +  </target>
   
  -    <available classpathref="classpath"
  -               property="mail.present" 
  -               classname="javax.mail.Session"/>
  +  <!-- Prepare the scratchpad -->
  +  <target name="prepare-scratchpad" depends="prepare-build, optional-tests" unless="exclude.scratchpad">
  +    <mkdir dir="${build.scratchpad.src}"/>
  +    <mkdir dir="${build.scratchpad.dest}"/>
  +    <copy todir="${build.scratchpad.src}" filtering="on">
  +      <fileset dir="${scratchpad.src}">
  +        <exclude name="**/Ifx*.java" unless="ifx.driver.present"/>
   
  -    <available classpathref="classpath"
  -               property="weblogic.present" 
  -               classname="weblogic.servlet.internal.ServletContextImpl"/>
  +        <exclude name="**/components/request/**"                unless="servlet.present"/>
  +        <exclude name="**/precept/**"                           unless="servlet.present"/>
  +        <exclude name="**/reading/ByteRangeResourceReader.java" unless="servlet.present"/>
  +        <exclude name="**/acting/SourceMultiAction.java"        unless="servlet.present"/>
  +        <exclude name="**/acting/SourceUploadAction.java"       unless="servlet.present"/>
  +        <exclude name="**/generation/RequestAttribute**.java"   unless="servlet.present"/>
   
  -    <available classpathref="classpath"
  -               property="jdbc3.present" 
  -               classname="java.sql.Savepoint"/>
  +        <exclude name="**/jxpath/**" unless="jxpath.present"/>
  +        <exclude name="**/taglib/**" unless="jxpath.present"/>
  +        <exclude name="**/transformation/TagTransformer.java" unless="jxpath.present"/>
   
  -    <available classpathref="classpath" 
  -               property="php.present" 
  -               classname="net.php.servlet"/>
  -
  -    <available classpathref="classpath" 
  -               property="naming.present" 
  -               classname="javax.naming.Context"/>
  -
  -    <available classpathref="classpath" 
  -               property="svg.present" 
  -               classname="org.apache.batik.transcoder.Transcoder"/>
  -<!--
  -    <available classpathref="classpath" 
  -               property="fop.present" 
  -               classname="org.apache.fop.apps.Driver"/>
  --->
  -    <available classpathref="classpath" 
  -               property="tidy.present" 
  -               classname="org.w3c.tidy.Tidy"/>
  -
  -    <available classpathref="classpath" 
  -               property="maybeupload.present" 
  -               classname="uk.co.weft.maybeupload.MaybeUploadRequestWrapper"/>
  -
  -    <available classpathref="classpath" 
  -               property="lucene.present" 
  -               classname="org.apache.lucene.search.Searcher"/>
  -
  -    <available classpathref="classpath" 
  -               property="hsqldb.present" 
  -               classname="org.hsqldb.Server"/>
  -
  -    <available classpathref="classpath" 
  -               property="jisp.present" 
  -               classname="com.coyotegulch.jisp.IndexedObjectDatabase"/>
  +        <exclude name="**/servlet/*Filter*.java" unless="servlet23.present"/>
   
  -    <available classpathref="classpath" 
  -               property="jxpath.present" 
  -               classname="org.apache.commons.jxpath.JXPathContext"/>
  -   
  -    <available classpathref="classpath" 
  -               property="httpclient.present" 
  -               classname="org.apache.commons.httpclient.HttpClient"/>
  +        <exclude name="**/components/axis/**" unless="activation.present"/>
  +        <exclude name="**/reading/AxisRPCReader.java" unless="activation.present"/>
  +        <exclude name="**/webservices/**" unless="activation.present"/>
   
  -    <available classpathref="classpath" 
  -               property="activation.present" 
  -               classname="javax.activation.DataSource"/>
  +        <exclude name="**/mail/**" unless="mail.present"/>
  +      </fileset>
  +    </copy>
  +  </target>
   
  -    <available classpathref="classpath" 
  -               property="mail.present" 
  -               classname="javax.mail.message"/>
  -  </target>
  -  
  -  <!-- =================================================================== -->
  -  <!-- Macro for optional warnings                                         -->
  -  <!-- =================================================================== -->
  -  <target name="op-warning" unless="omit.opt.warnings">
  -    <echo>**********************************************</echo>
  -    <echo>*</echo>
  -    <echo>*  Classes of the optional package ${thing} are not </echo>
  -    <echo>*  available. ${fullname} builds without them.</echo>
  -    <echo>*</echo>
  -    <echo>*  ${message}</echo>
  -    <echo>*</echo>
  -    <echo>*  Recovery:</echo>
  -    <echo>*  ${recovery}</echo>
  -    <echo>*</echo>    
  -    <echo>***********************************************</echo>
  -  </target>
  -  
  -  <!-- =================================================================== -->
  -  <!-- Warnings                                                            -->
  -  <!-- =================================================================== -->
  -  
  -  <!-- Outputs a warning if com.ibm.bsf.* classes are missing during compilation -->
  -  <target name="bsf-warn" unless="bsf.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="BSF"/>
  -      <param name="recovery" 
  -        value="Get the BSF package from http://oss.software.ibm.com/developerworks/projects/bsf/ and place the jar in the lib/optional dir"/>
  -      <param name="message" 
  -             value="BSF is required for the script action."/>
  -    </antcall>
  -  </target>  
  -  
  -  <!-- Outputs a warning if org.mozilla.javascript.* classes are missing during compilation -->
  -  <target name="rhino-warn" unless="rhino.interpreter.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Rhino"/>
  -      <param name="recovery" 
  -        value="Get the Rhino package from http://www.mozilla.org/rhino/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Rhino is required for the scripts and XSP in Javascript."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.python.* classes are missing during compilation -->
  -  <target name="python-warn" unless="python.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="jython"/>
  -      <param name="recovery" 
  -        value="Get the jython package from http://www.jython.org/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Jython is required for the scripts in Python."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.jfor.jfor.* classes are missing during compilation -->
  -  <target name="jfor-warn" unless="jfor.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="JFOR"/>
  -      <param name="recovery" 
  -        value="Get the JFOR package from http://www.jfor.org/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="JFOR is required for the fo2rtf serializer."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.xmldb.api.* classes are missing during compilation -->
  -  <target name="xmldb-warn" unless="xmldb.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="XMLDB"/>
  -      <param name="recovery" 
  -        value="Get the xmldb package from http://www.xmldb.org/xapi/ and place the xmldb-api jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="XMLDB is required for the xmldb and xmldbcollection generator."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if net.php.* classes are missing during compilation -->
  -  <target name="php-warn" unless="php.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="PHP"/>
  -      <param name="recovery" 
  -        value="Get the PHP servlet (phpsrvlt.jar) from http://www.php.net/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="PHP is required for the php generator."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if javax.naming.* classes are missing during compilation -->
  -  <target name="naming-warn" unless="naming.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="JNDI"/>
  -      <param name="recovery" 
  -        value="Get the jndi.jar from Sun and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="JNDI is required for the ldap generator and the parentcm generator."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.apache.batik.* classes are missing during compilation -->
  -  <target name="svg-warn" unless="svg.present" depends="optional-tests"> 
  -    <antcall target="op-warning">
  -      <param name="thing" value="Batik"/>
  -      <param name="recovery" 
  -        value="Get Batik from http://xml.apache.org/batik/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Batik is required for the svg serializers."/>
  -    </antcall>
  -  </target>
  -
  -  <!-- Outputs a warning if org.apache.fop.* classes are missing during compilation -->
  -<!--  
  -  <target name="fop-warn" unless="fop.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="FOP"/>
  -      <param name="recovery" 
  -        value="Get FOP from http://xml.apache.org/fop/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="FOP is required for the fo2pdf, fo2ps and fo2pcl serializer."/>
  -    </antcall>
  -  </target>
  --->  
  -  <!-- Outputs a warning if org.w3c.tidy.* classes are missing during compilation -->
  -  <target name="tidy-warn" unless="tidy.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="JTidy"/>
  -      <param name="recovery" 
  -        value="Get JTidy from http://sourceforge.net/projects/jtidy/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="JTidy is required for the html generator."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if uk.co.weft.maybeupload.* classes are missing during compilation -->
  -  <target name="maybeupload-warn" unless="maybeupload.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="MaybeUpload"/>
  -      <param name="recovery" 
  -        value="Get MaybeUpload from http://www.weft.co.uk/library/maybeupload/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="MaybeUpload simplifies the handling of uploaded files."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.apache.lucene.* classes are missing during compilation -->
  -  <target name="lucene-warn" unless="lucene.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Lucene"/>
  -      <param name="recovery" 
  -        value="Get Lucene from http://jakarta.apache.org/lucene/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Lucene is required for the Cocoon searches."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if com.hp.hpl.deli.* classes are missing during compilation -->
  -  <target name="deli-warn" unless="deli.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Deli"/>
  -      <param name="recovery" 
  -        value="Get Deli and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Deli is required for ..."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.apache.velocity.* classes are missing during compilation -->
  -  <target name="velocity-warn" unless="velocity.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Velocity"/>
  -      <param name="recovery" 
  -        value="Get Velocity from http://jakarta.apache.org/velocity/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Velocity is required for the velocity generator."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- Outputs a warning if org.hsqldb.* classes are missing during compilation -->
  -  <target name="hsqldb-warn" unless="hsqldb.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="hsqldb"/>
  -      <param name="recovery" 
  -        value="Get hsqldb from http://hsqldb.sourceforge.net/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="hsqldb is required for the sql examples."/>
  -    </antcall>
  -  </target>
  -
  -  <!-- Outputs a warning if org.apache.xml.resolver.* classes are missing during compilation -->
  -  <target name="resolver-warn" unless="resolver.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Resolver"/>
  -      <param name="recovery" 
  -        value="Get the resolver package from xml-commons CVS and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="The resolver allows entity resolving."/>
  -    </antcall>
  -  </target>
  -
  -  <!-- Outputs a warning if com.coyotegulch.jisp.* classes are missing during compilation -->
  -  <target name="jisp-warn" unless="jisp.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="jisp"/>
  -      <param name="recovery"
  -        value="Get the jisp package from http://www.coyotegulch.com/jisp/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="jisp is required for the JispFilesystemStore."/>
  -    </antcall>
  -  </target>
  -
  -  <!-- Outputs a warning if net.sf.pizzacompiler.compiler.* classes are missing during compilation -->
  -  <target name="pizza-warn" unless="pizza.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Pizza"/>
  -      <param name="recovery"
  -        value="Get the pizza package from http://pizzacompiler.sourceforge.net/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Pizza is the alternative Java compiler."/>
  -    </antcall>
  -  </target>
  -
  -  <!-- Outputs a warning if org.apache.poi.* classes are missing during compilation -->
  -  <target name="poi-warn" unless="poi.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="POI"/>
  -      <param name="recovery" 
  -        value="Get the POI package from http://jakarta.apache.org/poi/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="POI is required for the POI sitemap components."/>
  -    </antcall>
  -  </target>  
  -
  -  <!-- Outputs a warning if org.apache.commons.logging.* classes are missing during compilation -->
  -  <target name="commons-logging-warn" unless="commons.logging.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Jakarta Commons Logging"/>
  -      <param name="recovery" 
  -        value="Get the Jakarta Commons Logging package from http://jakarta.apache.org/commons/logging/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="The Jakarta Commons Logging package is required for the POI sitemap components."/>
  -    </antcall>
  -  </target>  
  -  
  -  <!-- Outputs a warning if org.apache.commons.jxpath.* classes are missing during compilation -->
  -  <target name="jxpath-warn" unless="jxpath.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="JXPath"/>
  -      <param name="recovery" 
  -        value="Get the JXPath package and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="The JXPath package is required for ...."/>
  -    </antcall>
  -  </target>  
  -     
  -  <!-- Outputs a warning if org.apache.commons.httpclient.* classes are missing during compilation -->
  -  <target name="httpclient-warn" unless="httpclient.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="HTTPClient"/>
  -      <param name="recovery" 
  -        value="Get the HTTP client package and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="The HTTP client package is required for ...."/>
  -    </antcall>
  -  </target>  
  -
  -  <!-- Outputs a warning if javax.activation.* classes are missing during compilation -->
  -  <target name="activation-warn" unless="activation.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Activation"/>
  -      <param name="recovery" 
  -        value="Get the SUN Activation package and place the jar in the lib/local dir"/>
  -      <param name="message"
  -             value="The SUN Activation package is required for the AxisRPCReader class"/>
  -    </antcall>
  -  </target>  
  -
  -  <!-- Outputs a warning if javax.mail.Message class is missing during compilation -->
  -  <target name="mail-warn" unless="mail.present" depends="optional-tests">
  -    <antcall target="op-warning">
  -      <param name="thing" value="Mail"/>
  -      <param name="recovery" 
  -        value="Get the mail package from http://java.sun.com/products/javamail/ and place the jar in the lib/optional dir"/>
  -      <param name="message"
  -             value="Mail is required for the Mail action."/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- =================================================================== -->
  -  <!-- Print out warnings for optional components                          -->
  -  <!-- =================================================================== -->
  -  <target name="optional-warnings" 
  -          depends="bsf-warn, rhino-warn, jfor-warn, xmldb-warn, php-warn, naming-warn, svg-warn, tidy-warn, maybeupload-warn, lucene-warn, deli-warn, velocity-warn, hsqldb-warn, resolver-warn, jisp-warn, pizza-warn, poi-warn, commons-logging-warn, jxpath-warn, httpclient-warn, activation-warn, mail-warn">
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepares the build directory                                        -->
  -  <!-- =================================================================== -->
  -  <target name="prepare" depends="init, optional-tests, optional-warnings">
  -    <mkdir dir="${build.dir}"/>
  -  </target>
  -
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepares the source code                                            -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-src-main" depends="prepare, generate-java-code, -copy-deprecated-stuff2core">
  -    <mkdir dir="${build.src}"/>
  -    <mkdir dir="${build.dest}"/>
  -    <copy todir="${build.src}" filtering="on">
  -          
  -      <fileset dir="${java.dir}">
  -      
  -<!-- present in lib/optional
  -        <exclude name="**/java/Pizza.java"         unless="pizza.present"/>
  -        <exclude name="**/java/pizza.*"            unless="pizza.present"/>
  -        <exclude name="**/java/javac.*"            if="pizza.present"/>
  -
  -        <exclude name="**/servlet.*"               unless="servlet.present"/>
  -        <exclude name="**/deli/DeliImpl.java"      unless="servlet.present"/>
  -        <exclude name="**/servlet/*.java"          unless="servlet.present"/>
  -        <exclude name="**/environment/http/*.java" unless="servlet.present"/>
  -        <exclude name="**/generation/StreamGenerator.java" unless="servlet.present"/>
  -        <exclude name="**/components/request/**"   unless="servlet.present"/>
  -
  -        <exclude name="**/deli/DeliImpl.java"      unless="deli.present"/>
  -        <exclude name="**/deli.*"                  unless="deli.present"/>
  -
  -        <exclude name="**/CompiledJavascript*"     unless="rhino.compiler.present"/>
  -        <exclude name="**/javascript/Javascript*"  unless="rhino.interpreter.present"/>
  -        <exclude name="**/javascript/javascript*"  unless="rhino.interpreter.present"/>
  -        <exclude name="**/xsp/JSGenerator.java"    unless="rhino.interpreter.present"/>
  -        <exclude name="**/xsp/javascript/**"       unless="rhino.interpreter.present"/>
  -        <exclude name="**/flow/javascript/**"      unless="rhino.interpreter.present"/>
  -
  -        <exclude name="**/components/resolver/ResolverImpl.java" unless="resolver.present"/>
  -        <exclude name="**/resolver.*"                            unless="resolver.present"/>
  -
  -        <exclude name="**/Jstyle*"             unless="jstyle.present"/>
  -
  -        <exclude name="**/XMLDB*.java"        unless="xmldb.present"/>
  -        <exclude name="**/DbXML*.java"        unless="xmldb.present"/>
  --->
  -        <exclude name="**/source/xmldb.*"     unless="xindice.present"/>
  -        <exclude name="**/generation/xmldb.*" unless="xindice.present"/>
  -<!--
  -        <exclude name="**/RTFSerializer.java" unless="jfor.present"/>
  -        <exclude name="**/jfor.*"             unless="jfor.present"/>
  -
  -        <exclude name="**/xpath/XPathProcessorImpl*" unless="xpath.present"/>
  -        <exclude name="**/xpath/JaxenProcessorImpl*" unless="jaxen.present"/>
  -
  -        <exclude name="**/components/hsqldb/ServerImpl.java" unless="hsqldb.present"/>
  -        <exclude name="**/hsqldb.*"                          unless="hsqldb.present"/>
  -
  -        <exclude name="**/components/store/Jisp*.java" unless="jisp.present"/>
  -        <exclude name="**/store/jisp.*"                unless="jisp.present"/>
  -
  -        <exclude name="**/components/xmlform/**"    unless="jxpath.present"/>
  -        <exclude name="**/samples/xmlform/**"       unless="jxpath.present"/>
  -        <exclude name="**/acting/**XMLForm**"       unless="jxpath.present"/>
  -        <exclude name="**/transformation/**XMLForm**"       unless="jxpath.present"/>
  -        <exclude name="**/components/validation/**" unless="jxpath.present"/>
  -
  -        <exclude name="**/WebServiceProxyGenerator.java" unless="httpclient.present"/>
  -        <exclude name="**/xsp/SOAPHelper.java"           unless="httpclient.present"/>
  -
  -        <exclude name="**/MaybeUpload*.java"           unless="maybeupload.present"/>
  -        <exclude name="**/http/RequestWrapper*.java"/>
  -        <exclude name="**/browser/*.x*"/>
  --->
  -
  -        <!-- Do not use FilesystemStore, it's broken. Unless you have to. -->
  -        <exclude name="**/store/file.*"                if="jisp.present"/>
  -      </fileset>
  -    </copy>
  -
  -    <if>
  -      <istrue value="${cocoon.webapp.scratchpad.include}"/>
  -      <then>
  -        <mkdir dir="${build.scratchpad.src}"/>
  -        <mkdir dir="${build.scratchpad.dest}"/>
  -        <copy todir="${build.scratchpad.src}" filtering="on">
  -          <fileset dir="${scratchpad.src}">
  -            <exclude name="**/Ifx*.java" unless="ifx.driver.present"/>
  -    
  -            <exclude name="**/components/request/**"                unless="servlet.present"/>
  -            <exclude name="**/precept/**"                           unless="servlet.present"/>
  -            <exclude name="**/reading/ByteRangeResourceReader.java" unless="servlet.present"/>
  -            <exclude name="**/acting/SourceMultiAction.java"        unless="servlet.present"/>
  -            <exclude name="**/acting/SourceUploadAction.java"       unless="servlet.present"/>
  -            <exclude name="**/generation/RequestAttribute**.java"   unless="servlet.present"/>
  -    
  -            <exclude name="**/jxpath/**" unless="jxpath.present"/>
  -            <exclude name="**/taglib/**" unless="jxpath.present"/>
  -            <exclude name="**/transformation/TagTransformer.java" unless="jxpath.present"/>
  -    
  -            <exclude name="**/XMLDB*.java" unless="xmldb.present"/>
  -            <exclude name="**/DbXML*.java" unless="xmldb.present"/>
  -    
  -            <exclude name="**/servlet/*Filter*.java" unless="servlet23.present"/>
  -    
  -            <exclude name="**/components/axis/**" unless="activation.present"/>
  -            <exclude name="**/reading/AxisRPCReader.java" unless="activation.present"/>
  -            <exclude name="**/webservices/**" unless="activation.present"/>
  -    
  -            <exclude name="**/mail/**" unless="mail.present"/>
  -          </fileset>
  -        </copy>
  -      </then>
  -    </if>
  -    
  +  <!-- Prepare deprecated code -->
  +  <target name="prepare-deprecated" depends="prepare-build" unless="exclude.deprecated">
       <mkdir dir="${build.deprecated.src}"/>
       <mkdir dir="${build.deprecated.dest}"/>
       <copy todir="${build.deprecated.src}" filtering="on">
  @@ -950,10 +228,8 @@
           <include name="**/*.java"/>
         </fileset>
       </copy>
  -  </target>
   
  -  <!-- INCLUDE DEPRECATED CLASSES TILL DEPENDENCIES ON THEM ARE FIXED      -->
  -  <target name="-copy-deprecated-stuff2core" depends="init" unless="deprecate">
  +    <!-- [FIXME] Copy over deprecated classes until dependencies are fixed -->
       <copy todir="${build.src}" filtering="on">
         <fileset dir="${deprecated.src}">
           <include name="**/*.java"/>
  @@ -961,31 +237,24 @@
       </copy>
     </target>
   
  -  <!-- Set a variable if the generated java code is already up-to-date.    -->
  -  <target name="generate-java-code-check" depends="init">
  -    <uptodate property="generate-java-code.notrequired"
  -        targetfile="${build.src}/org/apache/cocoon/components/browser/BrowserImpl.java" >
  -      <srcfiles dir="${java.dir}/org/apache/cocoon/components/browser"
  -          includes="BrowserImpl.xml,BrowserImpl.xsl"/>
  -    </uptodate>
  +  <!-- Prepare samples code -->
  +  <target name="prepare-samples" depends="prepare-build" unless="exclude.webapp.samples">
  +    <mkdir dir="${build.samples}"/>
  +    <copy todir="${build.samples}" filtering="on">
  +      <fileset dir="${samples}">
  +        <include name="**/*.java"/>
  +      </fileset>
  +    </copy>
     </target>
   
  -  <!-- Generate the Java code from XML using XSLT                          -->
  -  <target name="generate-java-code" depends="generate-java-code-check"
  -          unless="generate-java-code.notrequired">
  -    <xslt basedir="${java.dir}/org/apache/cocoon/components/browser"
  -           destdir="${build.src}/org/apache/cocoon/components/browser"
  -           includes="BrowserImpl.xml"
  -           extension=".java"
  -           style="${java.dir}/org/apache/cocoon/components/browser/BrowserImpl.xsl"/>
  -  </target>
  +<!-- Compilation Targets =================================================== -->
   
  +  <!-- compiles everything -->
  +  <target name="compile" depends="compile-core, compile-scratchpad, compile-deprecated"/>
  +
  +  <!-- compiles the core -->
  +  <target name="compile-core" depends="prepare-core">
   
  -  <!-- =================================================================== -->
  -  <!-- Compiles the source directory                                       -->
  -  <!-- =================================================================== -->
  -  <target name="compile-core" depends="prepare-src-main"
  -          description="Compiles the source code">
       <copy todir="${build.dest}">
         <fileset dir="${build.src}">
           <include name="**/Manifest.mf"/>
  @@ -998,78 +267,58 @@
         </fileset>
       </copy>
   
  -    <!-- A task to change the roles file. It is used to add optional components -->
  -    <taskdef name="roles-tool" classname="XConfToolTask" 
  -             classpath="${tools.dir}/anttasks"/>
  -
  -    <!-- Invoke the XConfTool to add optional roles for components -->
  -    <roles-tool directory="${build.src}"
  -                extension="xroles"
  -                configuration="${build.dest}/org/apache/cocoon/cocoon.roles"/>
  -
  -    <echo message="Compiling with Java ${ant.java.version}, debug ${debug}, optimize ${optimize}, deprecation ${deprecation}"/>
  +    <xpatch directory="${build.src}" extension="xroles" configuration="${build.dest}/org/apache/cocoon/cocoon.roles"/>
   
       <mkdir dir="${build.mocks}"/>
  -    <javac srcdir="${mocks.dir}"
  +    <javac srcdir="${mocks}"
              destdir="${build.mocks}"
  -           debug="${debug}"
  -           optimize="${optimize}"
  -           deprecation="${deprecation}"
  +           debug="${compiler.debug}"
  +           optimize="${compiler.optimize}"
  +           deprecation="${compiler.deprecation}"
              target="${target.vm}"
  -           nowarn="${nowarn}"
  -           fork="true">
  -      <classpath refid="classpath"/>
  -    </javac>
  +           nowarn="${compiler.nowarn}"
  +           compiler="${compiler}"
  +           classpathref="classpath"/>
   
       <javac srcdir="${build.src}"
              destdir="${build.dest}"
  -           debug="${debug}"
  -           optimize="${optimize}"
  -           deprecation="${deprecation}"
  +           debug="${compiler.debug}"
  +           optimize="${compiler.optimize}"
  +           deprecation="${compiler.deprecation}"
              target="${target.vm}"
  -           nowarn="${nowarn}"
  -           fork="true">
  -      <!--classpath refid="classpath"/-->
  -      <classpath>
  -        <path refid="classpath"/>
  -        <path location="${build.mocks}"/>
  -      </classpath>
  -    </javac>
  +           nowarn="${compiler.nowarn}"
  +           compiler="${compiler}"
  +           classpathref="classpath"/>
  +  </target>
  +
  +  <!-- compiles the scratchpad -->
  +  <target name="compile-scratchpad" depends="prepare-scratchpad" unless="exclude.scratchpad">
  +    <copy todir="${build.scratchpad.dest}">
  +      <fileset dir="${build.scratchpad.src}">
  +        <include name="**/Manifest.mf"/>
  +        <include name="**/*.xsl"/>
  +        <include name="**/*.wsdd"/>
  +        <include name="**/*.roles"/>
  +        <include name="META-INF/**"/>
  +      </fileset>
  +    </copy>
   
  -    <if>
  -      <istrue value="${cocoon.webapp.scratchpad.include}"/>
  -      <then>
  -        <copy todir="${build.scratchpad.dest}">
  -          <fileset dir="${build.scratchpad.src}">
  -            <include name="**/Manifest.mf"/>
  -            <include name="**/*.xsl"/>
  -            <include name="**/*.wsdd"/>
  -            <include name="**/*.roles"/>
  -            <include name="META-INF/**"/>
  -          </fileset>
  -        </copy>
  -
  -        <javac srcdir="${build.scratchpad.src}"
  -               destdir="${build.scratchpad.dest}"
  -               debug="${debug}"
  -               optimize="${optimize}"
  -               deprecation="${deprecation}"
  -               target="${target.vm}"
  -               fork="true">
  -          <!--classpath refid="scratchpad.classpath"/-->
  -          <classpath>
  -            <path refid="scratchpad.classpath"/>
  -            <path location="${build.mocks}"/>
  -          </classpath>
  -        </javac>
  -      </then>
  -    </if>    
  +    <javac srcdir="${build.scratchpad.src}"
  +           destdir="${build.scratchpad.dest}"
  +           debug="${compiler.debug}"
  +           optimize="${compiler.optimize}"
  +           deprecation="${compiler.deprecation}"
  +           target="${target.vm}"
  +           compiler="${compiler}"
  +           classpathref="scratchpad.classpath"/>
  +  </target>
   
  +  <!-- compiles deprecated code -->
  +  <target name="compile-deprecated" depends="prepare-deprecated" unless="exclude.deprecated">
       <copy todir="${build.deprecated.dest}">
         <fileset dir="${build.deprecated.src}">
           <include name="**/Manifest.mf"/>
           <include name="**/*.xsl"/>
  -        <include name="**/*.wsdd"/>
           <include name="**/*.roles"/>
           <include name="META-INF/**"/>
         </fileset>
  @@ -1077,135 +326,109 @@
   
       <javac srcdir="${build.deprecated.src}"
              destdir="${build.deprecated.dest}"
  -           debug="${debug}"
  -           optimize="${optimize}"
  -           deprecation="${deprecation}"
  +           debug="${compiler.debug}"
  +           optimize="${compiler.optimize}"
  +           deprecation="${compiler.deprecation}"
              target="${target.vm}"
  -           fork="true">
  -      <!--classpath refid="scratchpad.classpath"/-->
  -      <classpath>
  -        <path refid="scratchpad.classpath"/>
  -        <path location="{build.mocks}"/>
  -      </classpath>
  -    </javac>
  +           compiler="${compiler}"
  +           classpathref="classpath"/>
     </target>
   
  -
  -  <!-- =================================================================== -->
  -  <!-- Compiles the Java files in the src/samples/ directory               -->
  -  <!-- =================================================================== -->
  -  <target name="compile-samples" depends="init">
  -    <property name="build.dest.samples" value="${build.dest}/samples"/>
  -
  -    <mkdir dir="${build.dest.samples}"/>
  -    <javac srcdir="${webapp.dir}/samples"
  +  <!-- compiles sample code -->
  +  <target name="compile-samples" depends="prepare-samples" unless="exclude.webapp.samples">
  +    <javac srcdir="${build.samples}"
          destdir="${build.dest}"
  -       excludes="chaperon/**"
  -       debug="${debug}"
  -       optimize="${optimize}"
  -       deprecation="${deprecation}"
  +       debug="${compiler.debug}"
  +       optimize="${compiler.optimize}"
  +       deprecation="${compiler.deprecation}"
          target="${target.vm}"
  -       fork="true">
  -      <classpath refid="classpath"/>
  -    </javac>
  +       compiler="${compiler}"
  +       classpathref="classpath"/>
     </target>
   
  +<!-- Package Targets ======================================================= -->
   
  -  <!-- =================================================================== -->
  -  <!-- Creates the core Cocoon jar file                                    -->
  -  <!-- =================================================================== -->
  -  <target name="package-core" depends="compile-core" description="Generates the core Cocoon jar package">
  -    <jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
  +  <!-- packages everything -->
  +  <target name="package" depends="package-core, package-scratchpad, package-deprecated"/>
  +
  +  <!-- package the core -->
  +  <target name="package-core" depends="compile-core">
  +    <jar jarfile="${build}/${name}.jar" manifest="${build.src}/Manifest.mf">
         <fileset dir="${build.dest}">
           <include name="org/**"/>
           <include name="META-INF/**"/>
           <exclude name="org/apache/cocoon/samples/**"/>
         </fileset>
       </jar>
  +  </target>
   
  -    <if>
  -      <istrue value="${cocoon.webapp.scratchpad.include}"/>
  -      <then>
  -        <jar jarfile="${build.dir}/${scratchpad.name}.jar">
  -          <fileset dir="${build.scratchpad.dest}">
  -            <include name="org/**"/>
  -          </fileset>
  -        </jar>
  -      </then>
  -    </if>
  -    
  -    <jar jarfile="${build.dir}/${deprecated.name}.jar">
  -      <fileset dir="${build.deprecated.dest}">
  +  <!-- package the scratchpad -->
  +  <target name="package-scratchpad" depends="compile-scratchpad" unless="exclude.scratchpad">
  +    <jar jarfile="${build}/${name}-scratchpad.jar">
  +      <fileset dir="${build.scratchpad.dest}">
           <include name="org/**"/>
         </fileset>
       </jar>
     </target>
   
  -
  -  <!-- =================================================================== -->
  -  <!-- Compile also all blocks that are specified in properties.xml        -->
  -  <!-- =================================================================== -->
  -  <target name="compile" depends="package-core">
  -    <property name="compile.project" value="all"/>
  -    
  -    <delete file="${build.work}/blocks-build.xml"/>
  -    
  -    <xslt in="project-info.xml" 
  -          out="${build.work}/blocks-build.xml"
  -          processor="trax"
  -          style="${tools.dir}/src/blocks-build.xsl"/>
  -           
  -    <ant antfile="${build.work}/blocks-build.xml" 
  -         inheritAll="true" 
  -         inheritRefs="true"
  -         target="${compile.project}"/>
  -    
  -    <!-- FIXME: We have to rebuild the cocoon.jar in order to
  -                add the roles defined in the blocks -->
  -    <jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
  -      <fileset dir="${build.dest}">
  +  <!-- package deprecated code -->
  +  <target name="package-deprecated" depends="compile-deprecated" unless="exclude.deprecated">
  +    <jar jarfile="${build}/${name}-deprecated.jar">
  +      <fileset dir="${build.deprecated.dest}">
           <include name="org/**"/>
  -        <include name="META-INF/**"/>
  -        <exclude name="org/apache/cocoon/samples/**"/>
         </fileset>
       </jar>
     </target>
   
  -
  -  <!-- =================================================================== -->
  -  <!-- Default target compiles and packages Cocoon and all blocks          -->
  -  <!-- =================================================================== -->
  -  <target name="all" depends="compile" description="Default target (calls the 'compile' target)"/>
  -
  -
  -  <!-- =================================================================== -->
  -  <!-- Creates the samples jar file                                        -->
  -  <!-- =================================================================== -->
  -  <target name="package-samples" depends="compile-samples">
  -    <jar jarfile="${build.dir}/${name}-samples.jar">
  +  <!-- package sample code -->
  +  <target name="package-samples" depends="compile-samples" unless="exclude.webapp.samples">
  +    <jar jarfile="${build}/${name}-samples.jar">
         <fileset dir="${build.dest}">
           <include name="samples/**"/>
         </fileset>
       </jar>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Target called by Gump                                                -->
  -  <!-- =================================================================== -->
  -  <target name="gump" depends="docs, javadocs, test, package-core" description="[admin] Target called by Gump"/>
  -  
  -  <!-- =================================================================== -->
  -  <!-- Prepares the docs                                                   -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-docs" depends="check-jars">
  +<!-- Block Targets ========================================================= -->
  +
  +  <!-- compiles blocks -->
  +  <target name="blocks" depends="compile">
  +    <mkdir dir="${build.blocks}"/>
  +
  +    <xslt in="project-info.xml"
  +          out="${build.temp}/blocks-build.xml"
  +          processor="trax"
  +          style="${tools}/src/blocks-build.xsl"/>
  +
  +    <ant antfile="${build.temp}/blocks-build.xml"
  +         inheritAll="true"
  +         inheritRefs="false"
  +         target="compile"/>
  +  </target>
  +
  +<!-- Documentation Targets ================================================= -->
  +
  +  <target name="prepare-docs" depends="blocks">
  +
  +    <!-- Set classpath for documentation -->
  +    <path id="documentation.classpath">
  +      <path refid="classpath"/>
  +      <fileset dir="${build.blocks}">
  +        <include name="*.jar"/>
  +      </fileset>
  +      <fileset dir="${blocks}">
  +        <include name="*/lib/*.jar"/>
  +      </fileset>
  +      <path location="${tools.jar}"/>
  +      <path location="${build.context}/WEB-INF/classes"/>
  +    </path>
  +
       <mkdir dir="${build.context}"/>
       <mkdir dir="${build.context}/images"/>
  -    <mkdir dir="${build.docs}"/>
  -    <mkdir dir="${build.work}"/>
   
       <!-- make filtered copy of XML docs -->
       <copy todir="${build.context}" filtering="on">
  -      <fileset dir="${context.dir}">
  +      <fileset dir="${context}">
           <exclude name="images/**"/>
         </fileset>
       </copy>
  @@ -1219,997 +442,362 @@
       <replace file="${build.context}/xdocs/todo.xml"
                token="src/documentation/xdocs/dtd/" value="dtd/"/>
   
  -    <copy file="${build.dir}/jars.xml"
  -          tofile="${build.context}/xdocs/installing/jars.xml" filtering="off" overwrite="yes"/>
  -
       <!-- Copy images -->
       <copy todir="${build.context}/images" filtering="off">
  -      <fileset dir="${context.dir}/images"/>
  +      <fileset dir="${context}/images"/>
       </copy>
   
       <!-- Copy entity catalog and entities -->
       <copy todir="${build.context}/WEB-INF/entities" filtering="on">
  -      <fileset dir="${webapp.dir}/WEB-INF/entities"/>
  +      <fileset dir="${webapp}/WEB-INF/entities"/>
       </copy>
       <copy todir="${build.context}/WEB-INF/classes" filtering="on">
  -      <fileset dir="${webapp.dir}/WEB-INF/classes"/>
  +      <fileset dir="${webapp}/WEB-INF/classes"/>
       </copy>
  -    <copy todir="${build.context}" filtering="on" file="${webapp.dir}/WEB-INF/logkit.xconf">
  -    </copy>    
  +    <copy todir="${build.context}" filtering="on" file="${webapp}/WEB-INF/logkit.xconf"/>
     </target>
   
  -
  -  <!-- =================================================================== -->
  -  <!-- Set a variable if the generated docs are already up-to-date.        -->
  -  <!-- =================================================================== -->
  +  <!-- Set a variable if the generated docs are already up-to-date. -->
     <target name="docs_check" depends="prepare-docs">
       <uptodate property="docs.notrequired" targetfile="${build.docs}/index.html" >
         <srcfiles dir="." includes="changes.xml,todo.xml"/>
  -      <srcfiles dir="${build.dir}" includes="jars.xml"/>
  -      <srcfiles dir="${context.dir}/xdocs" includes="**/*.xml"/>
  +      <srcfiles dir="${build}" includes="jars.xml"/>
  +      <srcfiles dir="${context}/xdocs" includes="**/*.xml"/>
       </uptodate>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- If generated  docs is already up-to-date, print a message saying so. -->
  -  <!-- =================================================================== -->
  +  <!-- If generated docs are already up-to-date, print a message saying so. -->
     <target name="docs_done" depends="docs_check" if="docs.notrequired">
       <echo message="-------------------------------------------------------------"/>
       <echo message="Not rebuilding docs, as they are up-to-date:"/>
       <echo message="  ${build.docs}/index.html is more recent than"/>
  -    <echo message="  todo.xml, changes.xml, ${context.dir}/xdocs/*.xml"/>
  +    <echo message="  todo.xml, changes.xml, ${context}/xdocs/*.xml"/>
       <echo message="-------------------------------------------------------------"/>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- The documentation system                                            -->
  -  <!-- =================================================================== -->
  -  <target name="docs"
  -          depends="compile, prepare-docs, validate-xdocs, docs_done"
  -          unless="docs.notrequired"
  -          description="Builds the documentation">
  -    <java classname="org.apache.cocoon.Main" fork="true" dir="${build.context}"
  -          failonerror="true" maxmemory="128m">
  +  <!-- Create docs -->
  +  <target name="docs" depends="prepare-docs, validate-xdocs, docs_done" unless="docs.notrequired" description="Builds the documentation">
  +    <mkdir dir="${build.docs}"/>
  +    <mkdir dir="${build.temp.browser}"/>
  +
  +    <java classname="org.apache.cocoon.Main" fork="true" dir="${build.context}" failonerror="true" maxmemory="128m">
         <arg value="-c."/>
         <arg value="-d../docs"/>
  -      <arg value="-w../work"/>
  +      <arg value="-w../temp/docs"/>
         <arg value="-b../brokenlinks.txt"/>
  -      <arg value="-k../documentation/logkit.xconf"/>
  +      <arg value="-k./logkit.xconf"/>
         <arg value="-u${build.docs.loglevel}"/>
         <arg value="-V"/>
         <arg value="index.html"/>
         <classpath>
  -        <path refid="classpath"/>
  -        <fileset dir="${build.dir}">
  -          <include name="*.jar"/>
  -        </fileset>
  -        <pathelement location="${tools.jar}"/>
  -        <pathelement location="${build.context}/WEB-INF/classes"/>
  +        <path refid="documentation.classpath"/>
         </classpath>
       </java>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Set a variable if the generated docs are already up-to-date.        -->
  -  <!-- =================================================================== -->
  -  <target name="docs_clean" depends="init">
  -    <delete dir="${build.context}/../docs"/>
  -  </target>
  -  
  -  <!-- =================================================================== -->
  -  <!-- Copies the webapp directories                                       -->
  -  <!-- =================================================================== -->
  -  <target name="copy-webapp" depends="prepare-docs, prepare, compile">
  -    <mkdir dir="${build.war}"/>
  -
  -    <mkdir dir="${build.war}/WEB-INF/classes"/>
  -    <copy todir="${build.war}/WEB-INF/classes" filtering="off">
  -      <fileset dir="${build.dest}" includes="org/apache/cocoon/samples/**"/>
  -      <fileset dir="${build.src}" includes="org/apache/cocoon/samples/**"/>
  -    </copy>
  -
  -    <copy todir="${build.war}" filtering="on">
  -      <fileset dir="${webapp.dir}">
  -        <exclude name="**/*.gif"/>
  -        <exclude name="**/*.jpg"/>
  -        <exclude name="**/*.png"/>
  -        <exclude name="**/i18n/**"/>
  -        <exclude name="**/db/*"/>
  -      </fileset>
  -    </copy>
  -
  -    <copy todir="${build.war}" filtering="off">
  -      <fileset dir="${webapp.dir}">
  -        <include name="**/*.gif"/>
  -        <include name="**/*.jpg"/>
  -        <include name="**/*.png"/>
  -        <include name="**/i18n/**"/>
  -        <include name="**/db/*"/>
  -      </fileset>
  -    </copy>
  +  <!-- Prepares the printer-docs -->
  +  <target name="prepare-printer-docs" depends="prepare-docs">
  +    <mkdir dir="${build.context.printer}"/>
   
  -    <!-- copy the documentation, it's already prepared in the build context dir -->
  -    <mkdir dir="${build.war}/documentation"/>
  -    <copy todir="${build.war}/documentation" filtering="off">
  +    <!-- copy prepared docs -->
  +    <copy todir="${build.context.printer}" filtering="off">
         <fileset dir="${build.context}"/>
       </copy>
   
  -    <!-- correct the image references -->
  -    <!-- replace dir="${build.war}/documentation/svg" token="context://images" value="context://documentation/images"/ -->
  +    <!-- copy printer skin -->
  +    <copy todir="${build.context.printer}/stylesheets" filtering="off" overwrite="yes">
  +      <fileset dir="${build.context}/stylesheets/printer_skin"/>
  +    </copy>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Prepares the webapp directories                                     -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-webapp" depends="copy-webapp">
  -      <!-- A task to change the xconf. It is used to add optional components -->
  -      <taskdef name="xconf-tool" classname="XConfToolTask" 
  -          classpath="${tools.dir}/anttasks"/>
  -
  -      <!-- Invoke the XConfTool to add entries for optional components -->
  -      <xconf-tool directory="${build.src}"
  -                  extension="xmap"
  -                  configuration="${build.war}/sitemap.xmap"/>
  -
  -      <xconf-tool directory="${build.src}"
  -                  extension="xpipe"
  -                  configuration="${build.war}/sitemap.xmap"/>
  -
  -      <xconf-tool directory="${build.src}"
  -                  extension="samplesxpipe"
  -                  configuration="${build.war}/samples/sitemap.xmap"/>
  -
  -      <xconf-tool directory="${build.src}"
  -                  extension="xconf"
  -                  configuration="${build.war}/WEB-INF/cocoon.xconf"/>
  -
  -      <!-- Invoke the XConfTool to add entries for block components -->
  -      <xconf-tool directory="${build.blocks.root}"
  -                  extension="xmap"
  -                  configuration="${build.war}/sitemap.xmap"/>
  -
  -      <xconf-tool directory="${build.blocks.root}"
  -                  extension="xpipe"
  -                  configuration="${build.war}/sitemap.xmap"/>
  -
  -      <xconf-tool directory="${build.blocks.root}"
  -                  extension="samplesxpipe"
  -                  configuration="${build.war}/samples/sitemap.xmap"/>
  -
  -      <xconf-tool directory="${build.blocks.root}"
  -                  extension="xconf"
  -                  configuration="${build.war}/WEB-INF/cocoon.xconf"/>
  -                  
  -      <xconf-tool directory="${build.blocks.root}"
  -                  extension="xsamples"
  -                  configuration="${build.war}/samples/block-samples.xml"/>
  -
  -      <!-- Invoke the XConfTool to add optional entries for demos -->
  -      <xconf-tool directory="${build.war}"
  -                  extension="xpipe"
  -                  configuration="${build.war}/sitemap.xmap"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepares the javadocs for webapp                                    -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-webapp-javadocs" unless="exclude.javadocs">
  -    <antcall target="javadocs"/>
  -    <copy todir="${build.war}/apidocs" filtering="off">
  -      <fileset dir="${build.javadocs}"/>
  -    </copy>
  +  <!-- Set a variable if the generated printer docs are already up-to-date. -->
  +  <target name="printer-docs_check" depends="init">
  +    <uptodate property="printer-docs.notrequired" targetfile="${build.docs.printer}/index.html" >
  +      <srcfiles dir="." includes="changes.xml,todo.xml"/>
  +      <srcfiles dir="${docs}" includes="**/*.xml"/>
  +    </uptodate>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Prepares the webapp directories for scratchpad                      -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-webapp-scratchpad" depends="copy-webapp" unless="exclude.webapp.libs">
  -    <if>
  -      <istrue value="${cocoon.webapp.scratchpad.include}"/>
  -      <then>
  -          <!-- Invoke the XConfTool to add optional entries -->
  -          <xconf-tool directory="${build.scratchpad.src}"
  -                      extension="xmap"
  -                      configuration="${build.war}/sitemap.xmap"/>
  -    
  -          <xconf-tool directory="${build.scratchpad.src}"
  -                      extension="xpipe"
  -                      configuration="${build.war}/sitemap.xmap"/>
  -    
  -          <xconf-tool directory="${build.scratchpad.src}"
  -                      extension="xconf"
  -                      configuration="${build.war}/WEB-INF/cocoon.xconf"/>
  -    
  -        <!-- copy scratchpad webapp samples -->
  -        <copy todir="${build.war}" filtering="on">
  -          <fileset dir="${scratchpad.webapp}">
  -            <exclude name="**/*.gif"/>
  -            <exclude name="**/*.jpg"/>
  -            <exclude name="**/*.png"/>
  -         </fileset>
  -        </copy>
  -        <copy todir="${build.war}" filtering="off">
  -          <fileset dir="${scratchpad.webapp}">
  -            <include name="**/*.gif"/>
  -            <include name="**/*.jpg"/>
  -            <include name="**/*.png"/>
  -         </fileset>
  -        </copy>
  -      </then>
  -    </if>
  +  <!-- If generated printer docs are already up-to-date, print a message saying so. -->
  +  <target name="printer-docs_done" depends="printer-docs_check" if="printer-docs.notrequired">
  +    <echo message="-------------------------------------------------------------"/>
  +    <echo message="Not rebuilding printer docs, as they are up-to-date:"/>
  +    <echo message="  ${build.docs.printer}/index.html is more recent than"/>
  +    <echo message="  todo.xml, changes.xml, ${docs}/*.xml"/>
  +    <echo message="-------------------------------------------------------------"/>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Prepares the libraries for the war package                          -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-xsp" depends="package-core" if="build.precompile">
  -    <java classname="org.apache.cocoon.Main" fork="yes" failonerror="true">
  -      <arg line="-P -C ${build.war}/WEB-INF/cocoon.xconf -w ${build.war}/WEB-INF/classes -c ${build.war}" />
  +  <!-- Create printer friendly docs -->
  +  <target name="printer-docs" depends="prepare-printer-docs, validate-xdocs, printer-docs_done" description="Builds printer-friendly documentation">
  +    <mkdir dir="${build.docs.printer}"/>
  +    <mkdir dir="${build.temp.printer}"/>
  +
  +    <java classname="org.apache.cocoon.Main" fork="true" dir="${build.context.printer}" failonerror="true" maxmemory="128m">
  +      <arg value="-c."/>
  +      <arg value="-d../printer-docs"/>
  +      <arg value="-w../temp/printer"/>
  +      <arg value="-b../brokenlinks.txt"/>
  +      <arg value="-k./logkit.xconf"/>
  +      <arg value="-u${build.docs.printer.loglevel}"/>
  +      <arg value="-V"/>
  +      <arg value="index.html"/>
         <classpath>
  -        <fileset dir="${lib.dir}/endorsed">
  -          <include name="**/*.jar"/>
  -        </fileset>    
  -        <fileset dir="${lib.dir}/core">
  -          <include name="**/*.jar"/>
  -        </fileset>
  -        <fileset dir="${lib.dir}/core/jvm${target.vm}">
  -          <include name="*.jar"/>
  -        </fileset>
  -        <fileset dir="${lib.dir}/optional">
  -          <include name="**/*.jar"/>
  -        </fileset>
  -        <fileset dir="${lib.dir}/local">
  -          <include name="**/*.jar"/>
  -        </fileset>
  -        <pathelement location="${build.war}/WEB-INF/classes"/>
  -        <pathelement location="${build.dir}/${name}.jar"/>
  -        <pathelement location="${tools.jar}"/>
  +        <path refid="documentation.classpath"/>
         </classpath>
       </java>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Prepares the libraries for the war package                          -->
  -  <!-- =================================================================== -->
  -  <target name="copy-webapp-libs" depends="copy-tools-lib, check-jars" unless="exclude.webapp.libs">
  -    <copy todir="${build.war}/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/endorsed">
  +<!-- Javadoc Targets ======================================================= -->
  +
  +  <!-- Set a variable if javadocs are already up-to-date. -->
  +  <target name="javadocs_check">
  +    <mkdir dir="${build.javadocs}"/>
  +    <uptodate property="javadocs.notrequired" targetfile="${build.javadocs}/packages.html" >
  +      <srcfiles dir= "${build.src}" includes="**/*.java,**/package.html"/>
  +    </uptodate>
  +  </target>
  +
  +  <!-- If javadocs are already up-to-date, print a message saying so. -->
  +  <target name="javadocs_done" depends="javadocs_check" if="javadocs.notrequired">
  +    <echo message="-------------------------------------------------------------"/>
  +    <echo message="Not rebuilding Javadocs, as they are up-to-date:"/>
  +    <echo message="  ${build.javadocs}/packages.html is more recent than"/>
  +    <echo message="  ${build.src}/**/*.java"/>
  +    <echo message="-------------------------------------------------------------"/>
  +  </target>
  +
  +  <!-- Creates Javadocs -->
  +  <target name="javadocs" depends="prepare-core, javadocs_done" unless="javadocs.notrequired" description="Builds the API documentation (javadocs)">
  +    <javadoc packagenames="${packages}.*"
  +             additionalparam="-breakiterator -quiet"
  +             destdir="${build.javadocs}"
  +             author="true"
  +             version="true"
  +             use="true"
  +             noindex="false"
  +             splitindex="true"
  +             windowtitle="${Name} API ${version} [${TODAY}]"
  +             doctitle="${Name} API ${version}"
  +             bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
  +             stylesheetfile="${resource.styles}/javadoc.css"
  +             useexternalfile="yes">
  +      <fileset dir="${build}">
  +        <include name="src/**/*.java"/>
  +        <include name="blocks/**/*.java"/>
  +        <include name="deprecated/**/*.java"/>
  +      </fileset>
  +      <fileset dir="${blocks}">
  +        <include name="**/mocks/**/*.java"/>
  +      </fileset>
  +      <classpath refid="classpath"/>
  +    </javadoc>
  +  </target>
  +
  +<!-- Webapp targets ==================================================== -->
  +
  +  <target name="prepare-webapp" depends="package, blocks">
  +    <mkdir dir="${build.webapp}"/>
  +
  +    <copy file="${webapp}/welcome.xml" tofile="${build.webapp}/welcome.xml"/>
  +    <copy file="${webapp}/welcome.xslt" tofile="${build.webapp}/welcome.xslt"/>
  +    <copy file="${resources.logos}/cocoon-button-powered-158.gif" tofile="${build.webapp}/resources/images/powered.gif"/>
  +    <copy file="${resources.logos}/cocoon.ico" tofile="${build.webapp}/resources/images/cocoon.ico"/>
  +    <copy file="${resources.styles}/cocoon.css" tofile="${build.webapp}/resources/styles/cocoon.css"/>
  +
  +    <copy file="${webapp}/sitemap.xmap" tofile="${build.webapp}/sitemap.xmap"/>
  +
  +    <copy todir="${build.webapp}/WEB-INF" filtering="on">
  +      <fileset dir="${webapp}/WEB-INF">
  +        <include name="entities/**"/>
  +        <include name="classes/**"/>
  +        <include name="deli/**"/>
  +        <include name="*.x*"/>
  +      </fileset>
  +    </copy>
  +
  +    <copy file="${build}/${name}.jar" tofile="${build.webapp.lib}/${name}-${version}.jar"/>
  +    <copy file="${build}/${name}-deprecated.jar" tofile="${build.webapp.lib}/${name}-${version}-deprecated.jar"/>
  +
  +    <copy todir="${build.webapp.lib}">
  +      <fileset dir="${lib}/endorsed">
           <include name="*.jar"/>
           <exclude name="servlet*.jar"/>
         </fileset>
  -      <fileset dir="${lib.dir}/core">
  +      <fileset dir="${lib.core}">
           <include name="*.jar"/>
           <exclude name="servlet*.jar"/>
         </fileset>
  -      <fileset dir="${lib.dir}/core/jvm${target.vm}">
  +      <fileset dir="${lib.core}/jvm${target.vm}">
           <include name="*.jar"/>
         </fileset>
  -    </copy>
  -    <copy todir="${build.war}/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/optional">
  +      <fileset dir="${lib.optional}">
           <include name="*.jar"/>
           <exclude name="servlet*.jar"/>
         </fileset>
  -    </copy>
  -    <copy todir="${build.war}/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/local">
  +      <fileset dir="${lib.local}">
           <include name="*.jar"/>
           <exclude name="servlet*.jar"/>
         </fileset>
       </copy>
  -    <copy todir="${build.war}/WEB-INF/lib">
  -      <fileset dir="${build.dir}">
  +
  +    <copy todir="${build.webapp.lib}">
  +      <fileset dir="${build.blocks}">
           <include name="*-block.jar"/>
         </fileset>
         <mapper type="glob" from="*-block.jar" to="cocoon-*-block.jar"/>
  -    </copy>    
  -  </target>
  -
  -  <target name="prepare-webapp-libs" depends="package-core, package-samples, copy-webapp-libs" unless="exclude.webapp.libs">
  -    <copy file="${build.dir}/${name}.jar" tofile="${build.war}/WEB-INF/lib/${name}-${version}.jar"/>
  -    <copy file="${build.dir}/${name}-samples.jar"
  -      todir="${build.war}/WEB-INF/lib/"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepares the scratchpad libraries for the war package               -->
  -  <!-- =================================================================== -->
  -  <target name="copy-scratchpad-libs" depends="copy-webapp-libs" unless="exclude.webapp.libs">
  -    <if>
  -      <istrue value="${cocoon.webapp.scratchpad.include}"/>
  -      <then>
  -        <copy todir="${build.war}/WEB-INF/lib">
  -          <fileset dir="${scratchpad.lib}">
  -            <include name="*.jar"/>
  -            <exclude name="servlet*.jar"/>
  -          </fileset>
  -        </copy>
  -      </then>
  -    </if>
  -  </target>
  -
  -  <target name="prepare-scratchpad-libs" depends="copy-scratchpad-libs, prepare-webapp-libs" unless="exclude.webapp.libs">
  -    <if>
  -      <istrue value="${cocoon.webapp.scratchpad.include}"/>
  -      <then>
  -        <copy file="${build.dir}/${scratchpad.name}.jar" tofile="${build.war}/WEB-INF/lib/${scratchpad.name}.jar"/>
  -      </then>
  -    </if>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Copies the tools.jar to javac.jar in web-inf/lib                    -->
  -  <!-- =================================================================== -->
  -  <target name="copy-tools-lib" depends="copy-webapp" if="tools.jar.present" unless="pizza.present">
  -    <!-- NOTE: java.home is normally set by the JVM to the /jre directory  -->
  -    <copy file="${tools.jar}" tofile="${build.war}/WEB-INF/lib/javac.jar"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepare the war file                                                -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-war" depends="prepare-webapp, validate-config, validate-xdocs, prepare-webapp-javadocs, prepare-webapp-scratchpad, prepare-webapp-libs, prepare-scratchpad-libs, prepare-xsp" description="Prepares the war package">
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Creates the war file                                                -->
  -  <!-- =================================================================== -->
  -  <target name="webapp" depends="prepare-war" description="Builds the war package">
  -    <!-- A task to create manifest for webapp. -->
  -    <taskdef name="manifest" classname="ManifestToolTask" 
  -             classpath="${tools.dir}/anttasks"/>
  -
  -    <manifest directory="${build.war}/WEB-INF/lib"
  -              manifest="${build.war}/WEB-INF/Manifest.mf"/>
  +    </copy>
   
  -    <!-- Compatible testing of 'obsolete' exclude.webapp.samples and
  -         new property cocoon.webapp.samples.include -->
  -    <condition property="exclude.samples.from.webapp" value="true">
  -      <or>
  -        <isfalse value="${cocoon.webapp.samples.include}"/>
  -        <isset   property="exclude.webapp.samples"/>
  -      </or>
  -    </condition>
  +    <ant antfile="${build.temp}/blocks-build.xml"
  +         inheritAll="true"
  +         inheritRefs="false"
  +         target="lib"/>
   
  -    <!-- Compatible testing of 'obsolete' exclude.webapp.documentation and
  -         new property cocoon.webapp.documentation .include -->
  -    <condition property="exclude.documentation.from.webapp" value="true">
  -      <or>
  -        <isfalse value="${cocoon.webapp.documentation.include}"/>
  -        <isset   property="exclude.webapp.documentation"/>
  -      </or>
  -    </condition>
  +    <xpatch directory="${build.src}" extension="xmap" configuration="${build.webapp}/sitemap.xmap"/>
  +    <xpatch directory="${build.src}" extension="xpipe" configuration="${build.webapp}/sitemap.xmap"/>
  +    <xpatch directory="${build.src}" extension="xconf" configuration="${build.webapp}/WEB-INF/cocoon.xconf"/>
   
  -    <!-- Compatible testing of 'obsolete' exclude.webapp.javadocs and
  -         new property cocoon.webapp.javadocs.include -->
  -    <condition property="exclude.javadocs.from.webapp" value="true">
  -      <or>
  -        <isfalse value="${cocoon.webapp.javadocs.include}"/>
  -        <isset   property="exclude.webapp.javadocs"/>
  -      </or>
  -    </condition>
  -
  -    <jar jarfile="${build.dir}/${name}.war"
  -         manifest="${build.war}/WEB-INF/Manifest.mf">
  -      <fileset dir="${build.war}">
  -        <exclude name="samples/**"       if="exclude.samples.from.webapp"/>
  -        <exclude name="documentation/**" if="exclude.documentation.from.webapp"/>
  -        <exclude name="apidocs/**"       if="exclude.javadocs.from.webapp"/>
  -      </fileset>
  -    </jar>
  -    <jar jarfile="${build.dir}/${name}-webapp-samples.jar">
  -      <fileset dir="${build.war}">
  -         <include name="samples/**"/>
  -      </fileset>
  -    </jar>
  -    <jar jarfile="${build.dir}/${name}-webapp-docs.jar">
  -      <fileset dir="${build.war}">
  -         <include name="documentation/**"/>
  -         <include name="apidocs/**"/>
  -      </fileset>
  -    </jar>
  +    <ant antfile="${build.temp}/blocks-build.xml"
  +         inheritAll="true"
  +         inheritRefs="false"
  +         target="patch"/>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Creates a clean war file                                            -->
  -  <!-- =================================================================== -->
  -  <target name="clean-webapp" description="Builds the clean war package">
  -      <property name="exclude.webapp.samples"       value="true"/>
  -      <property name="exclude.webapp.documentation" value="true"/>
  -      <property name="exclude.webapp.javadocs"      value="true"/>
  -      <property name="exclude.webapp.libs"          value="false"/>
  -      <antcall target="webapp"/>
  -  </target>
  - 
  -  <!-- =================================================================== -->
  -  <!-- Creates a local webapp directly useable as a servlet context        -->
  -  <!-- =================================================================== -->
  -  <target name="webapp-local" depends="prepare-webapp, prepare-webapp-scratchpad, validate-config, validate-xdocs, copy-webapp-libs, copy-scratchpad-libs, compile-samples"
  -      description="Builds a local webapp directory usable as servlet context for quicker turn around">
  -    <copy todir="${build.war}/WEB-INF/classes">
  -      <fileset dir="${build.dest}"/>
  -      <fileset dir="${build.scratchpad.dest}"/>
  -    </copy>
  -  </target>
  +  <target name="prepare-webapp-samples" depends="package-samples" unless="exclude.webapp.samples">
   
  -  <!-- =================================================================== -->
  -  <!-- Removes existing uncompressed webapp                                -->
  -  <!-- =================================================================== -->
  -  <target name="remove-webapp" if="remove.webapp" description="Removes existing uncompressed webapp" depends="init">
  -    <delete dir="${install.war}/${name}"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Installs Cocoon file                                                -->
  -  <!-- =================================================================== -->
  -  <target name="install" depends="package-core, webapp, remove-webapp" if="install.war" 
  -          description="Installs the WAR package">
  -    <copy file="${build.dir}/${name}.war" tofile="${install.war}/${name}.war"/>
  -  </target>
  +    <copy file="${build}/${name}-samples.jar" tofile="${build.webapp.lib}/${name}-${version}-samples.jar"/>
   
  -  <!-- =================================================================== -->
  -  <!-- Set a variable if the generated printer docs are already up-to-date. -->
  -  <!-- =================================================================== -->
  -  <target name="printer-docs_check" depends="init">
  -    <uptodate property="printer-docs.notrequired" targetfile="${build.docs.printer}/index.html" >
  -      <srcfiles dir="." includes="changes.xml,todo.xml"/>
  -      <srcfiles dir="${docs.dir}" includes="**/*.xml"/>
  -    </uptodate>
  -  </target>
  +    <xpatch directory="${build.src}" extension="samplesxpipe" configuration="${build.webapp}/samples/sitemap.xmap"/>
   
  -  <!-- =================================================================== -->
  -  <!-- If generated printer docs is already up-to-date, print a message saying so. -->
  -  <!-- =================================================================== -->
  -  <target name="printer-docs_done" if="printer-docs.notrequired">
  -    <echo message="-------------------------------------------------------------"/>
  -    <echo message="Not rebuilding printer docs, as they are up-to-date:"/>
  -    <echo message="  ${build.docs.printer}/index.html is more recent than"/>
  -    <echo message="  todo.xml, changes.xml, ${docs.dir}/*.xml"/>
  -    <echo message="-------------------------------------------------------------"/>
  -  </target>
  +    <ant antfile="${build.temp}/blocks-build.xml"
  +         inheritAll="true"
  +         inheritRefs="false"
  +         target="samples"/>
   
  -  <!-- =================================================================== -->
  -  <!-- Create the announcements                                            -->
  -  <!-- =================================================================== -->
  -  <target name="announcement" 
  -          depends="prepare-docs" 
  -          description="[admin] Creates the announcement for new releases">
  +  </target>
   
  -    <copy file="announcement.xml" tofile="${build.context}\xdocs\announcement.xml" filtering="on"/>
  +  <target name="webapp" depends="prepare-webapp,prepare-webapp-samples"/>
   
  -    <xslt basedir="${build.context}\xdocs" 
  -           destdir="${build.dir}" 
  -           style="${build.context}\stylesheets\announcement2txt.xsl"
  -           includes="announcement.xml" 
  -           extension=".txt"
  -           force="true"/>
  +  <target name="war" depends="webapp">
  +    <!-- A task to create manifest for webapp. -->
  +    <taskdef name="manifest" classname="ManifestToolTask" classpath="${tools.tasks}"/>
  +    <!-- Create WAR manifest -->
  +    <manifest directory="${build.webapp.lib}" manifest="${build.webapp}/WEB-INF/Manifest.mf"/>
  +    <!-- Package WAR file -->
  +    <jar jarfile="${build.war}"  manifest="${build.webapp}/WEB-INF/Manifest.mf">
  +      <fileset dir="${build.webapp}"/>
  +    </jar>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Prepares the printer-docs                                           -->
  -  <!-- =================================================================== -->
  -  <target name="prepare-printer-docs" depends="prepare-docs">
  -    <mkdir dir="${build.dir}/printer_documentation"/>
  +<!-- Run targets =========================================================== -->
   
  -    <!-- copy prepared docs -->
  -    <copy todir="${build.dir}/printer_documentation" filtering="off">
  -      <fileset dir="${build.context}">
  -      </fileset>
  -    </copy>
  +  <target name="run" depends="init">
  +    <dirname property="antfile.dir" file="${ant.file}"/>
   
  -    <!-- copy printer skin -->
  -    <copy todir="${build.dir}/printer_documentation/stylesheets" filtering="off" overwrite="yes">
  -      <fileset dir="${build.context}/stylesheets/printer_skin">
  -      </fileset>
  -    </copy>
  -  </target>
  +    <java classname="org.mortbay.jetty.Server" dir="${tools.jetty}" fork="yes" failonerror="yes">
  +       <classpath>
  +         <fileset dir="${tools.jetty}/lib">
  +           <include name="*.jar"/>
  +         </fileset>
  +       </classpath>
   
  +       <jvmarg value="-Djava.endorsed.dirs=${java.endorsed.dirs}${path.separator}${antfile.dir}/${lib.endorsed}"/>
   
  -  <!-- =================================================================== -->
  -  <!-- Generate printer-friendly HTML docs                                 -->
  -  <!-- =================================================================== -->
  -  <target name="printer-docs" depends="package-core, prepare-printer-docs, printer-docs_check, printer-docs_done"
  -      unless="printer-docs.notrequired"
  -      description="Builds printer-friendly documentation">
  -    <mkdir dir="${build.docs.printer}"/>
  +       <sysproperty key="webapp" value="${antfile.dir}/${build.webapp}"/>
  +       <sysproperty key="org.xml.sax.parser" value="org.apache.xerces.parsers.SAXParser"/>
  +       <sysproperty key="jetty.port" value="${tools.jetty.port}"/>
   
  -    <java classname="org.apache.cocoon.Main" fork="true" dir="${build.dir}/printer_documentation" failonerror="true">
  -      <arg value="-c."/>
  -      <arg value="-d../printer-docs"/>
  -      <arg value="-w../work-printer"/>
  -      <arg value="-l../work-printer/cocoon.log"/>
  -      <arg value="-uINFO"/>
  -      <arg value="index.html"/>
  -      <classpath>
  -        <path refid="classpath"/>
  -        <fileset dir="${build.dir}">
  -          <include name="*.jar"/>
  -        </fileset>
  -        <pathelement location="${tools.jar}"/>
  -        <pathelement location="${build.context}/WEB-INF/classes"/>
  -      </classpath>
  +       <arg line="./conf/jettyconf.xml"/>
       </java>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Creates the web site                                                -->
  -  <!-- =================================================================== -->
  -  <target name="site" depends="docs, javadocs"
  -      description="[admin] Builds the web site">
  -    <mkdir dir="${site}"/>
  -    <copy todir="${site}" filtering="off">
  -      <fileset dir="${build.docs}">
  -      </fileset>
  -    </copy>
  -    <copy todir="${site}/apidocs" filtering="off">
  -      <fileset dir="${build.javadocs}"/>
  -    </copy>
  -  </target>
  +<!-- Validation targets ==================================================== -->
   
  -  <!-- =================================================================== -->
  -  <!-- Set a variable if javadoc is already up-to-date.                    -->
  -  <!-- =================================================================== -->
  -  <target name="javadocs_check">
  -    <mkdir dir="${build.javadocs}"/> 
  -    <uptodate property="javadocs.notrequired" targetfile="${build.javadocs}/packages.html" >
  -      <srcfiles dir= "${build.src}" includes="**/*.java,**/package.html"/>
  -    </uptodate>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- If javadoc is already up-to-date, print a message saying so.        -->
  -  <!-- =================================================================== -->
  -  <target name="javadocs_done" if="javadocs.notrequired">
  -    <echo message="-------------------------------------------------------------"/>
  -    <echo message="Not rebuilding Javadocs, as they are up-to-date:"/>
  -    <echo message="  ${build.javadocs}/packages.html is more recent than"/>
  -    <echo message="  ${build.src}/**/*.java"/>
  -    <echo message="-------------------------------------------------------------"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Creates the API documentation                                       -->
  -  <!-- =================================================================== -->
  -  <target name="javadocs" depends="prepare-src-main, javadocs_check, javadocs_done"
  -         unless="javadocs.notrequired"
  -         description="Builds the API documentation (javadocs)">
  -
  -    <!-- unfortunately we have to make a distinction between jdk 1.4 and before,
  -         because jdk 1.4 cannot cope very well with package names containing 'java'
  -         like in o.a.c.components.language.programming.java. -->
  -    <if>
  -      <equals arg1="1.4" arg2="${java.specification.version}"/>
  -      <then>
  -        <!-- Create the java docs for JDK 1.4 -->
  -        <javadoc packagenames="${packages}.*"
  -                 additionalparam="-subpackages ${packages} -breakiterator"
  -                 excludepackagenames="org.apache.cocoon.components.language.programming.java"
  -                 destdir="${build.javadocs}"
  -                 author="true"
  -                 version="true"
  -                 use="true"
  -                 noindex="false"
  -                 windowtitle="${Name} API (${version}, ${TODAY})"
  -                 doctitle="${Name}"
  -                 bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
  -                 stylesheetfile="${resource.dir}/javadoc.css"
  -                 useexternalfile="yes">
  -          <fileset dir="${build.dir}">
  -            <include name="src/**/*.java"/>
  -            <include name="blocks/**/*.java"/>
  -            <include name="deprecated/**/*.java"/>
  -          </fileset>
  -          <fileset dir="${blocks.dir}">
  -            <include name="**/mocks/**/*.java"/>
  -          </fileset>
  -          <classpath refid="classpath"/>
  -        </javadoc>
  -      </then>
  -      <else>
  -        <!-- Create the java docs for pre 1.4 -->
  -        <javadoc packagenames="${packages}.*"
  -                 destdir="${build.javadocs}"
  -                 author="true"
  -                 version="true"
  -                 use="true"
  -                 noindex="false"
  -                 windowtitle="${Name} API (${version}, ${TODAY})"
  -                 doctitle="${Name}"
  -                 bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
  -                 stylesheetfile="${resource.dir}/javadoc.css"
  -                 useexternalfile="yes">
  -          <!-- FIXME: Using this fileset technique fails with out-of-memory errors.
  -               It seems that the cause is loading too many individual *.java files.
  -               Try <sourcepath> instead and let javadoc load them.
  -          <fileset dir="${build.dir}">
  -            <include name="src/**/*.java"/>
  -            <include name="blocks/**/*.java"/>
  -            <include name="deprecated/**/*.java"/>
  -          </fileset>
  -          <fileset dir="${blocks.dir}">
  -            <include name="**/mocks/**/*.java"/>
  -          </fileset>
  -          -->
  -          <sourcepath location="${build.dir}/src"/>
  -          <sourcepath location="${build.dir}/blocks"/>
  -          <fileset dir="${blocks.dir}">
  -            <include name="**/mocks/**/*.java"/>
  -          </fileset>
  -          <classpath refid="classpath"/>
  -        </javadoc>
  -      </else>
  -    </if>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Generate the Emacs JDE project file                                 -->
  -  <!-- =================================================================== -->
  -  <target name="prj.el" depends="init, webapp-local"
  -          description="Generate the Emacs project file">
  -    <path id="jar.files">
  -      <fileset dir="${build.war}/WEB-INF/lib">
  -        <include name="*.jar"/>
  +  <!-- Check if all the JAR files are properly declared in lib/jars.xml    -->
  +  <target name="check-jars" depends="init">
  +    <path id="all.jars">
  +      <fileset dir="${lib}">
  +        <include name="**/*.jar"/>
         </fileset>
  -      <pathelement path="${build.context}/WEB-INF/classes"/>
       </path>
  -    <property name="jar.files" refid="jar.files"/>
  -    <copy file="${emacs.dir}/prj.el.in" tofile="prj.el" filtering="yes">
  +
  +    <property name="all.jars" refid="all.jars"/>
  +    <copy file="${lib}/jars.xml.tmpl" tofile="${build}/current-jars.xml" filtering="yes" overwrite="yes">
         <filterset>
  -        <filter token="jar.files" value="${jar.files}"/>
  -        <filter token="src.dir" value="${java.dir}"/>
  -        <filter token="build.war" value="${build.war}"/>
  +        <filter token="JARS" value="${all.jars}"/>
         </filterset>
       </copy>
  -  </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Prepares the source distribution                                    -->
  -  <!-- =================================================================== -->
  -  <target name="dist-src" depends="docs, javadocs" 
  -          description="Prepares the source distribution">
  -    <!-- Simply copy all and add the html docs -->
  -    <mkdir dir="${dist.root}"/>
  -    <mkdir dir="${dist.src}"/>
  -    <mkdir dir="${dist.src}/bin"/>
  -    <mkdir dir="${dist.src}/lib"/>
  -    <mkdir dir="${dist.src}/src"/>
  -    <mkdir dir="${dist.src}/src/java"/>
  -    <mkdir dir="${dist.src}/src/documentation"/>
  -    <mkdir dir="${dist.src}/src/resources"/>
  -    <mkdir dir="${dist.src}/src/scratchpad"/>
  -    <mkdir dir="${dist.src}/src/webapp"/>
  -    <mkdir dir="${dist.src}/docs"/>
  -    <mkdir dir="${dist.src}/docs/apidocs"/>
  -    <mkdir dir="${dist.src}/tools"/>
  -
  -    <copy todir="${dist.src}/tools">
  -      <fileset dir="${tools.dir}">
  -        <exclude name="anttasks/**"/> 
  -        <exclude name="lib/xalan*"/> 
  -        <exclude name="lib/xerces*"/> 
  -        <exclude name="lib/jtidy*"/> 
  -        <exclude name="lib/xml-apis.jar"/> 
  -      </fileset>
  -    </copy>
  -
  -    <copy todir="${dist.src}/src/documentation">
  -      <fileset dir="${build.context}"/>
  -    </copy>
  -
  -    <copy todir="${dist.src}/lib">
  -      <fileset dir="${lib.dir}"/>
  -    </copy>
  -
  -    <copy todir="${dist.src}/src/resources" filtering="on">
  -      <fileset dir="${resource.dir}">
  -        <exclude name="**/*.gif"/>
  -        <exclude name="**/*.jpg"/>
  -        <exclude name="**/*.png"/>
  -     </fileset>
  -    </copy>
  -
  -    <copy todir="${dist.src}/src/resources" filtering="off">
  -      <fileset dir="${resource.dir}">
  -        <include name="**/*.gif"/>
  -        <include name="**/*.jpg"/>
  -        <include name="**/*.png"/>
  -     </fileset>
  -    </copy>
  -
  -    <copy todir="${dist.src}/src/java" filtering="off">
  -      <fileset dir="${java.dir}"/>
  -    </copy>
  -
  -    <copy todir="${dist.src}/src/scratchpad" filtering="off">
  -      <fileset dir="${scratchpad.dir}"/>
  -    </copy>
  -    
  -    <copy todir="${dist.src}/src/webapp" filtering="on">
  -      <fileset dir="${webapp.dir}">
  -        <exclude name="**/*.gif"/>
  -        <exclude name="**/*.jpg"/>
  -        <exclude name="**/*.png"/>
  -     </fileset>
  -    </copy>
  +    <!-- split the path in 'jar' XML elements -->
  +    <replace file="${build}/current-jars.xml" token="${path.separator}" value="&lt;/jar&gt;&#xA; &lt;jar&gt;"/>
  +    <!-- relativize file names by removing the current directory -->
  +    <replace file="${build}/current-jars.xml" token="${user}${file.separator}lib${file.separator}" value=""/>
  +    <!-- and incase that fails, remove the base directory -->
  +    <replace file="${build}/current-jars.xml" token="${basedir}${file.separator}lib${file.separator}" value=""/>
   
  -    <copy todir="${dist.src}/src/webapp" filtering="off">
  -      <fileset dir="${webapp.dir}">
  -        <include name="**/*.gif"/>
  -        <include name="**/*.jpg"/>
  -        <include name="**/*.png"/>
  -     </fileset>
  -    </copy>
  +    <!-- replace platform-dependent path separator by '/' -->
  +    <replace file="${build}/current-jars.xml" token="${file.separator}" value="/"/>
   
  -    <!-- Fix for web.xml, cocoon.xconf and sitemap.xmap -->
  -    <copy file="${webapp.dir}/WEB-INF/cocoon.xconf" tofile="${dist.src}/src/webapp/WEB-INF/cocoon.xconf" filtering="off" overwrite="yes"/>
  -    <copy file="${webapp.dir}/sitemap.xmap" tofile="${dist.src}/src/webapp/sitemap.xmap" filtering="off" overwrite="yes"/>
  -    <copy file="${webapp.dir}/WEB-INF/web.xml" tofile="${dist.src}/src/webapp/WEB-INF/web.xml" filtering="off" overwrite="yes"/>
  +    <xslt in="${lib}/jars.xml" out="${build}/jars.xml"
  +           processor="trax"
  +           style="${tools}/src/check-jars.xsl">
  +      <param name="current-files" expression="../../${build}/current-jars.xml"/>
  +    </xslt>
  +  </target>
   
  -    <copy todir="${dist.src}/docs">
  -      <fileset dir="${build.docs}"/>
  -    </copy>
  -    <copy todir="${dist.src}/docs/apidocs">
  -      <fileset dir="${build.javadocs}"/>
  -    </copy>
  +  <!-- Validation of xdocs  -->
  +  <!-- This only does documentation/xdocs/**.xml and does not attempt to do
  +       webapps, blocks, java, etc. because most of their xdocs do not bother
  +       to declare a ruleset. -->
  +  <target name="validate-xdocs"
  +          description="Validation of all core XML documentation"
  +          depends="prepare-docs"
  +          if="validate.xdocs">
  +    <echo message="Conducting validation of core XML documentation."/>
  +    <echo message="(You can turn validation off if you must, commenting out the validate.xdocs property)"/>
   
  -    <copy todir="${dist.src}">
  -      <fileset dir="${docs.dir}">
  -        <include name="changes.xml, todo.xml"/>
  -      </fileset>
  -    </copy>
  -
  -    <copy todir="${dist.src}" filtering="on">
  -     <fileset dir=".">
  -      <include name="README"/>
  -      <include name="CREDITS"/>
  -      <include name="legal/*"/>
  -      <include name="WARNING"/>
  -      <include name="*.bat"/>
  -      <include name="*.sh"/>
  -      <include name="KEYS"/>
  -      <include name="*.xml"/>
  -      <include name="*.properties"/>
  -     </fileset>
  -    </copy>
  -    <copy file="INSTALL-SRC.txt" tofile="${dist.src}/INSTALL" filtering="on"/>
  -
  -    <chmod perm="+x" file="${dist.src}/run.sh"/>
  -    <chmod perm="+x" file="${dist.src}/build.sh"/>
  -    <chmod perm="+x" file="${dist.src}/tools/bin/antRun"/>
  -    <fixcrlf srcdir="${dist.src}" includes="**.sh"        eol="lf"/>
  -    <fixcrlf srcdir="${dist.src}" includes="antRun"       eol="lf"/>
  -    <fixcrlf srcdir="${dist.src}" includes="**.bat"      eol="crlf"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Packages the source distribution as .zip                            -->
  -  <!-- =================================================================== -->
  -  <target name="dist-src-zip" depends="dist-src">
  -    <zip zipfile="${dist.target}/${dist.name}-src.zip"
  -         basedir="${dist.root}/source"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Packages the source distribution with .tar.gzip                     -->
  -  <!-- =================================================================== -->
  -  <target name="dist-src-tgz" depends="dist-src">
  -    <tar tarfile="${dist.target}/${dist.name}-src.tar"
  -         basedir="${dist.root}/source"
  -         longfile="gnu"/>
  -    <gzip zipfile="${dist.target}/${dist.name}-src.tar.gz"
  -          src="${dist.target}/${dist.name}-src.tar"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepares the binary distribution                                    -->
  -  <!-- =================================================================== -->
  -  <target name="dist-bin" depends="package-core, webapp, docs, javadocs">
  -    <!-- Copy webapp and the html docs -->
  -    <mkdir dir="${dist.root}"/>
  -    <mkdir dir="${dist.bin}"/>
  -    <mkdir dir="${dist.bin}/webapp"/>
  -    <mkdir dir="${dist.bin}/docs"/>
  -    <mkdir dir="${dist.bin}/docs/apidocs"/>
  -
  -    <copy todir="${dist.bin}/webapp">
  -        <fileset dir="${build.war}"/>
  -    </copy>
  -
  -    <!-- And now the jars -->
  -    <copy todir="${dist.bin}/webapp/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/endorsed">
  -        <include name="*.jar"/>
  -        <exclude name="servlet*.jar"/>
  -      </fileset>
  -    </copy>    
  -    <copy todir="${dist.bin}/webapp/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/core">
  -        <include name="*.jar"/>
  -        <exclude name="servlet*.jar"/>
  -      </fileset>
  -      <fileset dir="${lib.dir}/core/jvm${target.vm}">
  -        <include name="*.jar"/>
  -      </fileset>
  -    </copy>
  -    <copy todir="${dist.bin}/webapp/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/optional">
  -        <include name="*.jar"/>
  -        <exclude name="servlet*.jar"/>
  -      </fileset>
  -    </copy>
  -    <copy todir="${dist.bin}/webapp/WEB-INF/lib">
  -      <fileset dir="${lib.dir}/local">
  -        <include name="*.jar"/>
  -        <exclude name="servlet*.jar"/>
  -      </fileset>
  -    </copy>
  +    <echo message="Validating all **/book.xml instances using RELAX NG ..."/>
  +    <jing rngfile="${webapp}/WEB-INF/entities/book-v01.rng">
  +      <fileset dir="${build.context}" includes="**/book.xml"/>
  +    </jing>
   
  -    <copy todir="${dist.bin}/webapp/WEB-INF/lib">
  -      <fileset dir="${build.dir}">
  -          <include name="*-block.jar"/>
  -      </fileset>
  -      <mapper type="glob" from="*-block.jar" to="cocoon-*-block-${version}.jar"/>
  -    </copy>    
  -
  -    <copy file="${build.dir}/${name}.jar"
  -          tofile="${dist.bin}/webapp/WEB-INF/lib/${name}-${version}.jar"/>
  -    <copy file="${build.dir}/${name}-samples.jar"
  -          todir="${dist.bin}/webapp/WEB-INF/lib/"/>
  +    <echo message="Validating all xdocs/**/*.xml instances using DTDs ..."/>
  +    <xmlvalidate failonerror="true" lenient="no" warn="yes">
  +      <!-- FIXME: we can use xmlcatalog with Ant-1.6 -->
  +      <fileset dir="${build.context}/xdocs" includes="**/*.xml"
  +               excludes="drafts/*.xml,dictionary.xml,catalog-test.xml,ctwig/sample/**/*.xml"/>
  +    </xmlvalidate>
   
  -    <copy todir="${dist.bin}/docs">
  -      <fileset dir="${build.docs}"/>
  -    </copy>
  -    <copy todir="${dist.bin}/docs/apidocs">
  -      <fileset dir="${build.javadocs}"/>
  -    </copy>
  +    <echo message="Validating the documentation sitemap.xmap using RELAX NG ..."/>
  +    <jing rngfile="${webapp}/WEB-INF/entities/sitemap-v06.rng">
  +      <fileset dir="${build.context}" includes="sitemap.xmap"/>
  +    </jing>
   
  -    <copy todir="${dist.bin}">
  -      <fileset dir="${docs.dir}">
  -        <include name="changes.xml, todo.xml"/>
  -      </fileset>
  -    </copy>
  -
  -    <copy todir="${dist.bin}" filtering="on">
  -     <fileset dir=".">
  -      <include name="CREDITS"/>
  -      <include name="README"/>
  -      <include name="legal/*"/>
  -      <include name="WARNING"/>
  -      <include name="KEYS"/>
  -     </fileset>
  -    </copy>
  -    <copy file="INSTALL-BIN.txt" tofile="${dist.bin}/INSTALL" filtering="on"/>
  -
  -    <!-- Build the war file -->
  -    <jar jarfile="${dist.bin}/${name}.war" 
  -         basedir="${dist.bin}/webapp" 
  -         includes="**" 
  -         excludes="samples/**"
  -         manifest="${build.war}/WEB-INF/Manifest.mf"/>
  -
  -    <!-- Delete the webapp directory -->
  -    <delete dir="${dist.bin}/webapp"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Packages the binary distribution as .zip                            -->
  -  <!-- =================================================================== -->
  -  <target name="dist-bin-zip" depends="dist-bin">
  -    <zip zipfile="${dist.target}/${dist.name}-bin.zip"
  -         basedir="${dist.root}/bin"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Packages the binary distribution with .tar.gzip                     -->
  -  <!-- =================================================================== -->
  -  <target name="dist-bin-tgz" depends="dist-bin">
  -    <tar tarfile="${dist.target}/${dist.name}-bin.tar"
  -         basedir="${dist.root}/bin"
  -         longfile="gnu"/>
  -    <gzip zipfile="${dist.target}/${dist.name}-bin.tar.gz"
  -          src="${dist.target}/${dist.name}-bin.tar"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Prepares the binary distribution                                    -->
  -  <!-- =================================================================== -->
  -  <target name="dist-samples" depends="webapp">
  -    <!-- Copy webapp and the html docs -->
  -    <mkdir dir="${dist.samples}/samples"/>
  -    <copy todir="${dist.samples}/samples">
  -        <fileset dir="${build.war}/samples"/>
  -    </copy>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Packages the samples distribution as .zip                            -->
  -  <!-- =================================================================== -->
  -  <target name="dist-samples-zip" depends="dist-samples">
  -    <zip zipfile="${dist.target}/${dist.name}-samples.zip"
  -         basedir="${dist.samples}"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Packages the samples distribution with .tar.gzip                     -->
  -  <!-- =================================================================== -->
  -  <target name="dist-samples-tgz" depends="dist-samples">
  -    <tar tarfile="${dist.target}/${dist.name}-samples.tar"
  -         basedir="${dist.samples}"
  -         longfile="gnu"/>
  -    <gzip zipfile="${dist.target}/${dist.name}-samples.tar.gz"
  -          src="${dist.target}/${dist.name}-samples.tar"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Build all distributions                                             -->
  -  <!-- =================================================================== -->
  -  <target name="dist-info" depends="init">
  -    <echo>**********************************************</echo>
  -    <echo>*</echo>
  -    <echo>*  Build all distributions:</echo> 
  -    <echo>*  - source distribution for windows/unix.</echo>
  -    <echo>*  - binary distribution for windows/unix.</echo>
  -    <echo>*</echo>        
  -    <echo>*  This may take a while...</echo>        
  -    <echo>*</echo>        
  -    <echo>***********************************************</echo>
  -    <echo/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Build all distributions                                             -->
  -  <!-- =================================================================== -->
  -  <target name="dist"
  -          depends="dist-info, dist-bin-tgz, dist-bin-zip, dist-src-tgz, dist-src-zip, dist-samples-tgz, dist-samples-zip"
  -          description="[admin] Builds the distributions">
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Clean targets                                                       -->
  -  <!-- =================================================================== -->
  -  <target name="clean" depends="init" description="Cleans the build directories">
  -    <delete dir="${build.dir}"/>
  -    <delete dir="${tools.dir}/anttasks"/>
  +    <echo message="Validating all documentation stylesheets using RELAX NG ..."/>
  +    <jing rngfile="${webapp}/WEB-INF/entities/xslt-20020523.rng">
  +      <fileset dir="${build.context}/stylesheets" includes="**/*.xsl"/>
  +    </jing>
     </target>
   
  -  <target name="distclean" depends="clean" description="Cleans everything to the original state">
  -    <delete dir="${build.root}"/>
  -    <delete file="${dist.target}/${Name}-${version}.tar.gz"/>
  -    <delete file="${dist.target}/${Name}-${version}.tar"/>
  -    <delete file="${dist.target}/${Name}-${version}.zip"/>
  -    <delete file="${dist.target}/${Name}-${version}-src.tar.gz"/>
  -    <delete file="${dist.target}/${Name}-${version}-src.tar"/>
  -    <delete file="${dist.target}/${Name}-${version}-src.zip"/>
  -    <delete file="${dist.target}/${Name}-${version}-bin.tar.gz"/>
  -    <delete file="${dist.target}/${Name}-${version}-bin.tar"/>
  -    <delete file="${dist.target}/${Name}-${version}-bin.zip"/>
  -    <delete file="${dist.target}/${Name}-${version}-samples.tar.gz"/>
  -    <delete file="${dist.target}/${Name}-${version}-samples.tar"/>
  -    <delete file="${dist.target}/${Name}-${version}-samples.zip"/>
  -    <delete dir="${dist.root}"/>
  -  </target>
  +<!-- Test targets =========================================================== -->
  +
  +  <!-- Runs all tests -->
  +  <target name="test" depends="junit.tests, anteater.tests" description="Runs all tests"/>
   
  -  <!-- =================================================================== -->
  -  <!-- Test targets                                                       -->
  -  <!-- =================================================================== -->
  -  <target name="test" depends="junit.tests, anteater.tests"
  -          description="Runs all the tests"/>
  -
  -  <!-- =================================================================== -->
  -  <!-- Junit Test targets                                                  -->
  -  <!-- =================================================================== -->
  -  <target name="junit.tests" depends="compile" description="[admin] Perform jUnit tests">
  +  <!-- Runs JUnit tests -->
  +  <target name="junit.tests" depends="compile" description="Runs the unit tests">
       <mkdir dir="${build.test}"/>
  +
       <!-- Copy test files to build test dir -->
       <copy todir="${build.test}" filtering="on">
  -      <fileset dir="${test.dir}"/>
  +      <fileset dir="${test}"/>
       </copy>
  +
       <!-- Compile tests -->
       <javac srcdir="${build.test}"
               destdir="${build.test}"
  -            debug="${debug}"
  -            optimize="${optimize}"
  -            deprecation="${deprecation}"
  +            debug="${compiler.debug}"
  +            optimize="${compiler.optimize}"
  +            deprecation="${compiler.deprecation}"
               target="${target.vm}"
               fork="true">
         <classpath refid="classpath"/>
  @@ -2241,11 +829,8 @@
       </junit>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Anteater tests                                                      -->
  -  <!-- =================================================================== -->
  -  <target name="anteater.tests"
  -          description="Runs the Anteater functional tests">
  +  <!-- Anteater tests  -->
  +  <target name="anteater.tests" description="Runs the functional tests">
       <property name="host" value="localhost"/>
       <property name="port" value="8080"/>
       <property name="base" value="cocoon"/>
  @@ -2255,227 +840,57 @@
       </exec>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Fix line endings in src                                             -->
  -  <!-- =================================================================== -->
  -  <target name="fixsrclf" depends="init" description="Fix lf in src directory (internal use only!)">
  -    <fixcrlf srcdir="${java.dir}" includes="**/*.java" eol="lf"/>
  -  </target>
  +<!-- IDE targets =========================================================== -->
   
  -  <!-- =================================================================== -->
  -  <!-- Check if all the JAR files are properly declared in lib/jars.xml    -->
  -  <!-- =================================================================== -->
  -  <target name="check-jars" depends="init">
  -    <path id="all.jars">
  -      <fileset dir="${lib.dir}">
  -        <include name="**/*.jar"/>
  +  <!-- Generate the Emacs JDE project file -->
  +  <target name="emacs-project" depends="init" description="Generate the Emacs project files">
  +    <path id="jar.files">
  +      <fileset dir="${build.webapp}/WEB-INF/lib">
  +        <include name="*.jar"/>
         </fileset>
  +      <pathelement path="${build.context}/WEB-INF/classes"/>
       </path>
  -
  -    <property name="all.jars" refid="all.jars"/>
  -    <copy file="${lib.dir}/jars.xml.tmpl"
  -          tofile="${build.dir}/current-jars.xml"
  -          filtering="yes"
  -          overwrite="yes">
  +    <property name="jar.files" refid="jar.files"/>
  +    <copy file="${resource}/dev/emacs/prj.el.in" tofile="prj.el" filtering="yes">
         <filterset>
  -        <filter token="JARS" value="${all.jars}"/>
  +        <filter token="jar.files" value="${jar.files}"/>
  +        <filter token="src" value="${java}"/>
  +        <filter token="build.webapp" value="${build.webapp}"/>
         </filterset>
       </copy>
  -    
  -    <!-- split the path in 'jar' XML elements -->
  -    <replace file="${build.dir}/current-jars.xml"
  -             token="${path.separator}" value="&lt;/jar&gt;&#xA; &lt;jar&gt;"/>
  -    <!-- relativize file names by removing the current directory -->
  -    <replace file="${build.dir}/current-jars.xml"
  -             token="${user.dir}${file.separator}lib${file.separator}" value=""/>
  -    <!-- and incase that fails, remove the base directory -->
  -    <replace file="${build.dir}/current-jars.xml"
  -             token="${basedir}${file.separator}lib${file.separator}" value=""/>
  -
  -    <!-- replace platform-dependent path separator by '/' -->
  -    <replace file="${build.dir}/current-jars.xml"
  -             token="${file.separator}" value="/"/>
  -
  -    <xslt in="${lib.dir}/jars.xml" out="${build.dir}/jars.xml"
  -           processor="trax"
  -           style="${tools.dir}/src/check-jars.xsl">
  -      <param name="current-files"
  -             expression="../../${build.dir}/current-jars.xml"/>
  -    </xslt>
  -  </target>
  -  
  -  
  -  <!-- =================================================================== -->
  -  <!-- Validation of core important configuration files using RELAX NG     -->
  -  <!-- =================================================================== -->
  -  <!-- Depends on "prepare-webapp" target, so that the sitemaps are generated
  -       and copied to the build.
  -       Uses the Jing anttask.
  -   -->
  -  <target name="validate-config"
  -          description="Validation of core configuration files using RELAX NG"
  -          depends="prepare-webapp"
  -          if="validate.config">
  -    <echo message="Conducting validation of core configuration files."/>
  -    <echo message="(You can turn validation off if you must, using ./properties.xml)"/>
  -
  -    <!-- cocoon.roles -->
  -    <echo message="Validating all cocoon.roles instances ..."/>
  -    <jing rngfile="${webapp.dir}/WEB-INF/entities/roles-v01.rng">
  -      <fileset dir="${build.dir}" includes="**/cocoon.roles"/>
  -    </jing>
  -
  -    <!-- All stylesheets **/*.xsl -->
  -    <echo message="Validating all stylesheets ..."/>
  -    <jing rngfile="${webapp.dir}/WEB-INF/entities/xslt-20020523.rng">
  -      <!-- FIXME: Need catalog entity resolver, so excluding catalog tester xsl -->
  -      <!-- FIXME: Excluding the "hello world" SWF sitemap (minor issue) -->
  -      <fileset dir="${src.dir}" includes="**/*.xsl"
  -               excludes="**/catalog/style.xsl, **/simple-page2swf.xsl"/>
  -      <fileset dir="${tools.dir}" includes="**/*.xsl"/>
  -    </jing>
  -
  -    <!-- The Treeprocessor builtins -->
  -    <echo message="Validating the treeprocessor builtins ..."/>
  -    <xmlvalidate failonerror="true" lenient="no" warn="yes">
  -      <fileset dir="${java.dir}" includes="**/treeprocessor-builtins.xml"/>
  -    </xmlvalidate>
  -
  -    <!-- sitemap.xmap -->
  -    <!-- leaving this until last because it is the one most likely to break -->
  -    <echo message="Validating all sitemap.xmap instances ..."/>
  -    <!-- FIXME: The sitemaps and their RNG grammar still need tweaking -->
  -    <jing rngfile="${webapp.dir}/WEB-INF/entities/sitemap-v06.rng">
  -      <fileset dir="${build.dir}" includes="**/sitemap.xmap"/>
  -    </jing>
     </target>
   
  -  <!-- =================================================================== -->
  -  <!-- Validation of xdocs                                                 -->
  -  <!-- =================================================================== -->
  -  <!-- This only does documentation/xdocs/**.xml and does not attempt to do
  -       webapps, blocks, java, etc. because most of their xdocs do not bother
  -       to declare a ruleset. -->
  -  <target name="validate-xdocs"
  -          description="Validation of all core XML documentation"
  -          depends="prepare-docs"
  -          if="validate.xdocs">
  -    <echo message="Conducting validation of core XML documentation."/>
  -    <echo message="(You can turn validation off if you must, using ./properties.xml)"/>
  -
  -    <echo message="Validating all **/book.xml instances using RELAX NG ..."/>
  -    <jing rngfile="${webapp.dir}/WEB-INF/entities/book-v01.rng">
  -      <fileset dir="${build.context}" includes="**/book.xml"/>
  -    </jing>
  -
  -    <echo message="Validating all xdocs/**/*.xml instances using DTDs ..."/>
  -    <xmlvalidate failonerror="true" lenient="no" warn="yes">
  -      <!-- FIXME: we can use xmlcatalog with Ant-1.6 -->
  -      <fileset dir="${build.context}/xdocs" includes="**/*.xml"
  -               excludes="drafts/*.xml,dictionary.xml,catalog-test.xml,ctwig/sample/**/*.xml"/>
  -    </xmlvalidate>
  -
  -    <echo message="Validating the documentation sitemap.xmap using RELAX NG ..."/>
  -    <jing rngfile="${webapp.dir}/WEB-INF/entities/sitemap-v06.rng">
  -      <fileset dir="${build.context}" includes="sitemap.xmap"/>
  -    </jing>
  +  <!-- Build the Eclipse projects files -->
  +  <target name="eclipse-project" depends="init" description="Generate the Eclipse project files">
   
  -    <echo message="Validating all documentation stylesheets using RELAX NG ..."/>
  -    <jing rngfile="${webapp.dir}/WEB-INF/entities/xslt-20020523.rng">
  -      <fileset dir="${build.context}/stylesheets" includes="**/*.xsl"/>
  -    </jing>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Generate Schematron validators from RNG grammars.                   -->
  -  <!-- Evidently this will not work with Xalan due to a bug.               -->
  -  <!-- Needs XSLTC or Saxon7 (but the classpath attribute won't work).     -->
  -  <!--                                                                     -->
  -  <!-- These are two temporary targets undergoing testing.                 -->
  -  <!--===================================================================  -->
  -  <!-- Depends on some "prepare-*" targets, so that the sitemaps are generated
  -       and copied to the build.
  -  -->
  -  <target name="prepare-schematron"
  -          description="Generate Schematron schema from RNG grammar"
  -          depends="prepare-webapp, prepare-webapp-scratchpad"
  -          if="validate.config">
  -    <echo message="Generating Schematron schemas from RELAX NG grammars"/>
  -    <echo message="Currently doing: sitemap.rng only"/>
  -    <xslt in="${webapp.dir}/WEB-INF/entities/sitemap-v06.rng"
  -          out="${tools.dir}/src/schematron/sitemap.sch"
  -          style="${tools.dir}/src/schematron/RNG2Schtrn.xsl"/>
  -    <echo message="Generating XSLT validators from Schematron schemas"/>
  -    <xslt in="${tools.dir}/src/schematron/sitemap.sch"
  -          out="${tools.dir}/src/schematron/validate-sitemap.xsl"
  -          style="${tools.dir}/src/schematron/schematron-basic.xsl"/>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Validate with Schematron                                            -->
  -  <!--===================================================================  -->
  -  <target name="validate-schematron"
  -          description="Validate against Schematron schemas generated from RNG grammars"
  -          depends="prepare-schematron">
  -    <echo message="NOTE: this is an experimental build target."/>
  -    <echo message="Removing any old reports ..."/>
  -    <delete quiet="yes">
  -      <fileset dir="${build.dir}" includes="**/sitemap.report" />
  -    </delete>
  -    <echo message="Running schematron validators"/>
  -    <echo message="Currently doing: **/sitemap.xmap only"/>
  -    <xslt basedir="${build.dir}" includes="**/sitemap.xmap"
  -          destdir="${build.dir}" extension=".report"
  -          style="${tools.dir}/src/schematron/validate-sitemap.xsl"/>
  -    <echo message="Removing any empty reports ..."/>
  -    <delete quiet="yes">
  -      <fileset dir="${build.dir}" includes="**/sitemap.report" >
  -        <size value="0"/>
  -      </fileset>
  -    </delete>
  -    <echo message="Listing any new error reports ..."/>
  -    <apply executable="ls" failonerror="false" skipemptyfilesets="true">
  -      <fileset dir="${build.dir}" includes="**/sitemap.report" />
  -      <arg value="-l"/>
  -    </apply>
  -    <apply executable="false" failonerror="true" skipemptyfilesets="true">
  -      <fileset dir="${build.dir}" includes="**/sitemap.report" />
  -    </apply>
  -  </target>
  -
  -  <!-- =================================================================== -->
  -  <!-- Build the Eclipse projects files                                    -->
  -  <!--===================================================================  -->
  -  <target name="eclipse-project" depends="init">
  -  
       <!-- prepare the various paths that will form the project -->
  -    <path id="src.dirs">
  +    <path id="srcs">
         <!-- main source dir -->
  -      <pathelement path="${src.dir}/java"/>
  +      <pathelement path="${src}/java"/>
         <!-- deprecated source dir -->
  -      <pathelement path="${src.dir}/deprecated/java"/>
  +      <pathelement path="${src}/deprecated/java"/>
         <!-- scratchpad source dir -->
  -      <pathelement path="${src.dir}/scratchpad/src"/>
  +      <pathelement path="${src}/scratchpad/src"/>
         <!-- blocks source dirs -->
  -      <dirset dir="${blocks.dir}">
  +      <dirset dir="${blocks}">
           <include name="*/java"/>
         </dirset>
       </path>
  -    
  -    <path id="mocks.dirs">
  +
  +    <path id="mockss">
         <!-- main mocks dir -->
  -      <pathelement path="${mocks.dir}"/>
  +      <pathelement path="${mocks}"/>
         <!-- scratchpad mocks dir -->
  -      <pathelement path="${src.dir}/scratchpad/mocks"/>
  +      <pathelement path="${src}/scratchpad/mocks"/>
         <!-- blocks mocks dirs -->
  -      <dirset dir="${blocks.dir}">
  +      <dirset dir="${blocks}">
           <include name="*/mocks"/>
         </dirset>
       </path>
  -    
  +
       <path id="libs">
         <!-- main libs -->
  -      <fileset dir="${lib.dir}">
  +      <fileset dir="${lib}">
           <include name="core/*.jar"/>
           <include name="core/jvm${target.vm}/*.jar"/>
           <include name="optional/*.jar"/>
  @@ -2483,56 +898,56 @@
           <include name="endorsed/*.jar"/>
         </fileset>
         <!-- scratchpad libs -->
  -      <fileset dir="${scratchpad.dir}/lib">
  +      <fileset dir="${scratchpad}/lib">
           <include name="*.jar"/>
         </fileset>
         <!-- tools libs -->
  -      <fileset dir="${tools.dir}/lib">
  +      <fileset dir="${tools}/lib">
           <include name="*.jar"/>
           <!-- exclude xerces, xalan, xmlapis -->
           <exclude name="x*.jar"/>
         </fileset>
         <!-- no block-specific libs for now -->
       </path>
  -    
  +
       <!-- convert paths to properties -->
  -    <property name="src.dirs" refid="src.dirs"/>
  -    <property name="mocks.dirs" refid="mocks.dirs"/>
  +    <property name="srcs" refid="srcs"/>
  +    <property name="mockss" refid="mockss"/>
       <property name="libs" refid="libs"/>
  -    
  +
       <!-- expand properties in the template file -->
  -    <copy file="${src.dir}/resources/dev/eclipse/classpath-tmpl.xml"
  -          tofile="${build.work}/classpath-temp.xml"
  +    <copy file="${resource}/dev/eclipse/classpath-tmpl.xml"
  +          tofile="${build.temp}/classpath-temp.xml"
             filtering="yes"
             overwrite="yes">
         <filterset>
  -        <filter token="SRC_DIRS" value="${src.dirs}"/>
  +        <filter token="SRC_DIRS" value="${srcs}"/>
           <filter token="LIBS" value="${libs}"/>
  -        <filter token="MOCKS_DIRS" value="${mocks.dirs}"/>
  +        <filter token="MOCKS_DIRS" value="${mockss}"/>
         </filterset>
       </copy>
  -    
  +
       <!-- split the path in 'item' XML elements -->
  -    <replace file="${build.work}/classpath-temp.xml"
  +    <replace file="${build.temp}/classpath-temp.xml"
                token="${path.separator}" value="&lt;/item&gt;&#xA; &lt;item&gt;"/>
       <!-- relativize file names by removing the current directory -->
  -    <replace file="${build.work}/classpath-temp.xml"
  -             token="${user.dir}${file.separator}" value=""/>
  +    <replace file="${build.temp}/classpath-temp.xml"
  +             token="${user}${file.separator}" value=""/>
       <!-- and in case that fails, remove the base directory -->
  -    <replace file="${build.work}/classpath-temp.xml"
  +    <replace file="${build.temp}/classpath-temp.xml"
                token="${basedir}${file.separator}" value=""/>
   
       <!-- replace platform-dependent path separator by '/' -->
  -    <replace file="${build.work}/classpath-temp.xml"
  +    <replace file="${build.temp}/classpath-temp.xml"
                token="${file.separator}" value="/"/>
   
       <!-- now build the .classpath file -->
  -    <xslt in="${build.work}/classpath-temp.xml" out="${basedir}/.classpath"
  +    <xslt in="${build.temp}/classpath-temp.xml" out="${basedir}/.classpath"
             processor="trax"
  -          style="${src.dir}/resources/dev/eclipse/make-classpath.xsl"/>
  -    
  +          style="${resource}/dev/eclipse/make-classpath.xsl"/>
  +
       <!-- copy the project file (expand version) -->
  -    <copy file="${src.dir}/resources/dev/eclipse/project"
  +    <copy file="${resource}/dev/eclipse/project"
             tofile="${basedir}/.project"
             overwrite="yes">
         <filterset>
  @@ -2541,44 +956,63 @@
       </copy>
     </target>
   
  -    
  -  <!-- ***************************************************************** -->
  -  <!-- ***************************************************************** -->
  -  <!-- **                                                             ** -->
  -  <!-- **              LOCAL SERVER RUN ACTION                        ** -->
  -  <!-- **                                                             ** -->
  -  <!-- ***************************************************************** -->
  -  <!-- ***************************************************************** -->
  -
  -  <target name="run" 
  -          description="Run Jetty with configuration set by the jetty.run property"
  -          depends="init">
  -    
  -    <antcall target="webapp-local"/>
  -
  -    <copy file="${tools.dir}/jetty/conf/jettyconf.xml"
  -          todir="${build.war}" filtering="on"/>
  -   
  -    <java classname="org.mortbay.jetty.Server"
  -          dir="${build.war}"
  -          fork="yes"
  -          failonerror="yes">
  -       <classpath>
  -         <path refid="classpath" />
  -         <fileset dir="${tools.dir}/jetty/lib">
  -           <include name="*.jar"/>
  -           <include name="*.JAR"/>
  -           <include name="*.zip"/>
  -           <include name="*.ZIP"/>
  -         </fileset>         
  -       </classpath>
  -      
  -       <jvmarg value="-Djava.endorsed.dirs=${java.endorsed.dirs}${path.separator}${endorsed.dir}"/>
  -       <sysproperty key="jetty.home" value="${antfile.dir}/build/cocoon/webapp/"/>
  -       <sysproperty key="org.xml.sax.parser" value="org.apache.xerces.parsers.SAXParser"/>
  -       <arg line="jettyconf.xml" />
  -    </java>
  -  </target>  
  +<!-- Admin targets ========================================================= -->
  +
  +  <!-- Gump target -->
  +  <target name="gump" depends="docs, javadocs, package, blocks, test"/>
  +
  +  <!-- Creates the web site  -->
  +  <target name="site" depends="docs, javadocs">
  +    <mkdir dir="${site}"/>
  +    <copy todir="${site}" filtering="off">
  +      <fileset dir="${build.docs}"/>
  +    </copy>
  +    <copy todir="${site}/apidocs" filtering="off">
  +      <fileset dir="${build.javadocs}"/>
  +    </copy>
  +  </target>
  +
  +  <!-- Create the announcements -->
  +  <target name="announcement" depends="prepare-docs">
  +    <copy file="announcement.xml" tofile="${build.context}\xdocs\announcement.xml" filtering="on"/>
  +    <xslt basedir="${build.context}\xdocs"
  +           destdir="${build}"
  +           style="${build.context}\stylesheets\announcement2txt.xsl"
  +           includes="announcement.xml"
  +           extension=".txt"
  +           force="true"/>
  +  </target>
  +
  +<!-- Clean Targets ========================================================= -->
  +
  +  <!-- Clean the build -->
  +  <target name="clean" depends="init">
  +    <delete dir="${build}"/>
  +  </target>
  +
  +  <!-- Clean the webapp -->
  +  <target name="clean-webapp" depends="init">
  +    <delete dir="${build.webapp}"/>
  +  </target>
  +
  +  <!-- Clean the distribution -->
  +  <target name="distclean" depends="clean">
  +    <delete dir="${build.root}"/>
  +    <delete dir="${tools.tasks}"/>
  +    <delete file="${dist}/${Name}-${version}.tar.gz"/>
  +    <delete file="${dist}/${Name}-${version}.tar"/>
  +    <delete file="${dist}/${Name}-${version}.zip"/>
  +    <delete file="${dist}/${Name}-${version}-src.tar.gz"/>
  +    <delete file="${dist}/${Name}-${version}-src.tar"/>
  +    <delete file="${dist}/${Name}-${version}-src.zip"/>
  +    <delete file="${dist}/${Name}-${version}-bin.tar.gz"/>
  +    <delete file="${dist}/${Name}-${version}-bin.tar"/>
  +    <delete file="${dist}/${Name}-${version}-bin.zip"/>
  +    <delete file="${dist}/${Name}-${version}-samples.tar.gz"/>
  +    <delete file="${dist}/${Name}-${version}-samples.tar"/>
  +    <delete file="${dist}/${Name}-${version}-samples.zip"/>
  +    <delete dir="${dist.root}"/>
  +  </target>
  +
   </project>
   
  -<!-- End of file -->
  
  
  
  1.10      +18 -21    xml-cocoon2/project-info.xml
  
  Index: project-info.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/project-info.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- project-info.xml	11 Feb 2003 03:23:18 -0000	1.9
  +++ project-info.xml	20 Feb 2003 20:08:24 -0000	1.10
  @@ -2,6 +2,7 @@
   <module name="xml-cocoon2">
   
     <url href="http://xml.apache.org/cocoon/index.html"/>
  +  
     <description>
       Java XML publishing framework - version 2
     </description>
  @@ -14,7 +15,6 @@
       ********************************************
     -->
     
  -
     <project name="xml-cocoon2">
       <package>org.apache.cocoon</package>
   
  @@ -363,26 +363,6 @@
            
     </project>    
     
  -  <project name="samples-block">
  -    <package>org.apache.cocoon</package>
  -    
  -    <ant target="block">
  -      <property name="block-name" value="samples"/>
  -    </ant>
  -    
  -    <depend project="xml-cocoon2"/>
  -    
  -    <work nested="tools/anttasks"/>
  -    <home nested="build/cocoon"/>
  -    
  -    <jar name="samples-block.jar"/>
  -
  -    <nag from="Nicola Ken Barozzi &lt;nicolaken@apache.org&gt;"
  -         to="cocoon-dev@xml.apache.org"/>
  -         
  -  </project>    
  -    
  -  
     <project name="php-block">
       <package>org.apache.cocoon</package>
       
  @@ -601,6 +581,23 @@
            to="cocoon-dev@xml.apache.org"/>
     </project>
     
  +  <project name="xmldb-block">
  +    <package>org.apache.cocoon</package>
  +
  +    <ant target="block">
  +      <property name="block-name" value="xmldb"/>
  +    </ant>
  +
  +    <depend project="xml-cocoon2"/>
  +
  +    <work nested="tools/anttasks"/>
  +    <home nested="build/cocoon"/>
  +
  +    <jar name="xmldb-block.jar"/>
  +
  +    <nag from="Gianugo &lt;gianugo@apache.org&gt;" 
  +         to="cocoon-dev@xml.apache.org"/>
  +  </project>
         
     <!--
       ********************************************
  
  
  
  1.1                  xml-cocoon2/blocks.properties
  
  Index: blocks.properties
  ===================================================================
  #exclude.block.fop=true
  #exclude.block.batik=true
  #exclude.block.chaperon=true
  #exclude.block.itext=true
  #exclude.block.jfor=true
  #exclude.block.swf=true
  #exclude.block.session-fw=true
  #exclude.block.authentication-fw=true
  #exclude.block.portal-fw=true
  #exclude.block.databases=true
  #exclude.block.hsqldb=true
  #exclude.block.precept=true
  #exclude.block.poi=true 
  #exclude.block.naming=true
  #exclude.block.jsp=true
  #exclude.block.php=true
  #exclude.block.python=true
  #exclude.block.lucene=true        
  #exclude.block.html=true
  #exclude.block.linkrewriter=true
  #exclude.block.bsf=true
  #exclude.block.profiler=true        
  #exclude.block.velocity=true
  #exclude.block.web3=true
  #exclude.block.slide=true
  #exclude.block.xmldb=true
  
                    
  
  
  1.1                  xml-cocoon2/build.old.xml
  
  Index: build.old.xml
  ===================================================================
  <!-- ===========================================================================
  
  
                         * =========================== *
                         |  Apache Cocoon Build System |
                         * =========================== *
  
                                       by
  
                       Stefano Mazzocchi <st...@apache.org>
                       Carsten Ziegeler <cz...@apache.org>
  
  
  Installing the build tools
  ==========================
  
  The Cocoon build system is based on Apache Ant, which is a Java building tool
  originally developed for the Tomcat project but now used in many other
  Apache projects and extended by many developers.
  
  Ant is a little but very handy tool that uses a build file written in XML
  (this file) as building instructions. For more information refer to
  "http://jakarta.apache.org/ant/".
  
  To make things easier for you, the Cocoon distribution contains a precompiled
  version of Ant and the build scripts take care of running it.
  
  The only thing that you have to make sure, is the "JAVA_HOME" environment
  property should be set to match the JVM you want to use.
  
  That's all you have to do to be ready to go.
  
  
  Building instructions
  =====================
  
  Ok, let's build the baby. First, make sure your current working directory is
  where this very file is located. Then type
  
    ./build.sh (unix)
    .\build.bat (win32)
  
  if everything is right and all the required packages are visible, this action
  will generate a file called "cocoon.jar" in the "./build/cocoon" directory.
  Note, that if you do further development, compilation time is reduced since
  Ant is able of detecting which files have changed and to recompile them at need.
  
  Also, you'll note that reusing a single JVM instance for each task, increases
  tremendously the performance of the whole build system, compared to other
  tools (i.e. make or shell scripts) where a new JVM is started for each task.
  
  
  Building on another directory
  =============================
  
  Sometimes you might want to build on an external directory to keep the
  distribution clean: no worries, this is just an environment property away.
  Suppose you want to use the "../build" directory instead, you simply tipe
  
   [unix]  ./build.sh  -Dbuild.root=../build
   [win32] .\build.bat -Dbuild.root=..\build
  
  By using the -Dxxx=yyy argument, you are setting environments in the JVM: Ant
  is designed to give higher priority to system environments to allow you to
  modify _any_ <property> that you can find in the building instructions below,
  so it's just a matter of understanding what property you want to change
  and you don't have to touch this file (which you shouldn't need to do).
  
  
  Build targets
  =============
  
  The build system is not only responsible of compiling Cocoon into a jar file,
  but is also responsible for creating the HTML documentation, javadocs,
  distributions and web site. In fact, the file you have here is _exactly_ what
  is used by cocoon maintainers to take care of everything in the Cocoon
  project, no less and no more.
  
  To know more about the available targets take a look at this file, which is
  pretty self-explanatory or type
  
   [unix]  ./build.sh  -projecthelp
   [win32] .\build.bat -projecthelp
  
  and concentrate on the target descriptions that start with a star '*': these
  are the one you should call, the others are internal targets that are called
  by the main ones.
  
  Build Dependencies
  ==================
  Some components are optional and require special jar files to be compiled
  and added to the web application. Some if these jars are already included
  in the distribution while others not.
  For each optional package which is not available, a warning is
  printed. If you don't like these warnings, specify the property "omit.opt.warnings"
  (build -Domit.opt.warnings).
  
  
                                Happy hacking from the Apache Cocoon Dev Team :)
  
  CVS: $Id: build.old.xml,v 1.1 2003/02/20 20:08:21 stefano Exp $:
  
  ============================================================================ -->
  
  <project default="all" basedir="." name="Apache Cocoon">
  
    <!--
      Give user a chance to override without editing this file
      (and without typing -D each time he compiles it)
    -->
    <property file=".ant.properties"/>
    <property file="${user.home}/.ant.properties"/>
  
    <!--
      these are here only for those who use jikes @namer. For other
      developers this part makes no difference.
    -->
    <property name="build.compiler.emacs" value="on"/>
    <!-- property name="build.compiler.warnings" value="true"/ -->
    <property name="build.compiler.pedantic" value="false"/>
    <property name="build.compiler.depend" value="true"/>
    <property name="build.compiler.fulldepend" value="true"/>
  
    <!-- =================================================================== -->
    <!-- Initialization target                                               -->
    <!-- =================================================================== -->
    <target name="init">
  
      <tstamp/>
  
      <!-- Detecting the current jvm -->
      <condition property="target.vm" value="1.4">
        <equals arg1="1.4" arg2="${java.specification.version}"/>
      </condition>
      <condition property="target.vm" value="1.2">
        <not>
          <equals arg1="1.4" arg2="${java.specification.version}"/>
        </not>
      </condition>
  
      <!-- =================================================================== -->
      <!-- Identify Classpath                                                 -->
      <!-- =================================================================== -->
      <path id="classpath">
        <fileset dir="./lib/local">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/endorsed">
          <include name="*.jar"/>
        </fileset>      
        <fileset dir="./lib/core">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/core/jvm${target.vm}">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/optional">
          <include name="*.jar"/>
        </fileset>
      </path>
  
      <path id="anttasks.classpath">
        <fileset dir="./lib/local">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/endorsed">
          <include name="*.jar"/>
        </fileset>      
        <fileset dir="./lib/core">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/core/jvm${target.vm}">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/optional">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./tools/lib">
          <include name="*.jar"/>
        </fileset>
      </path>
  
      <path id="scratchpad.classpath">
        <fileset dir="./lib/local">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/endorsed">
          <include name="*.jar"/>
        </fileset>      
        <fileset dir="./lib/core">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/core/jvm${target.vm}">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./lib/optional">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="./src/scratchpad/lib">
          <include name="*.jar"/>
        </fileset>
        <!-- FIXME : how to build a path that references a property set in 'init' target ? -->
        <!-- NKB use the top-level tasks in Ant 1.5.1+ -->
        <pathelement path="./build/cocoon/classes"/>
      </path>
  
      <!-- =================================================================== -->
      <!-- Properties                                                          -->
      <!-- =================================================================== -->
  
      <dirname property="antfile.dir" file="${ant.file}"/>
    
      <!-- Get the properties from the properties.xml file -->
      <xmlproperty file="properties.xml"
                   keeproot="false" 
                   collapseAttributes="true" />
      <condition property="validate.config">
        <istrue value="${build.validate.config}"/>
      </condition>
      <condition property="validate.xdocs">
        <istrue value="${build.validate.xdocs}"/>
      </condition>
  
      <echo message="--------------------------------------------------------------"/>
      <echo message="            ${fullname} ${version} [${year}]                  "/>
      <echo message="--------------------------------------------------------------"/>
      <echo message="Building with ${ant.version}"/>
      <echo message="using build file ${ant.file}"/>
      <echo message="--------------------------------------------------------------"/>
      <echo message=" WARNING:                                                     "/>
      <echo message="   This build is targeted for use with JVM ${target.vm}"/>
      <echo message="                                                              "/>
      <echo message="   Using this build on a virtual machine other than the one   "/>
      <echo message="   it is targeted for may result in runtime errors.          "/>
      <echo message="                                                              "/>
      <echo message="--------------------------------------------------------------"/>
  
      <!-- The location of tools.jar, relative to the JAVA_HOME home. -->
      <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
      <available file="${tools.jar}" property="tools.jar.present"/>
  
      <filter token="Name"    value="${fullname}"/>
      <filter token="name"    value="${fullname}"/>
      <filter token="year"    value="${year}"/>
      <filter token="version" value="${version}"/>
      <filter token="date"    value="${TODAY}"/>
      <filter token="log"     value="true"/>
      <filter token="verbose" value="true"/>
      <filter token="released.version" value="${released.version}"/>
      <filter token="install.war" value="${install.war}"/>
  
      <!-- Add filters for loading database information  -->
      <filter token="database-driver" value="${cocoon.samples.database.driver}"/>
      <filter token="database-url" value="${cocoon.samples.database.url}"/>
      <filter token="database-user" value="${cocoon.samples.database.user}"/>
      <filter token="database-password" value="${cocoon.samples.database.password}"/>
  
      <!-- Use Jing for XML validation with RELAX NG -->
      <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
        <classpath refid="anttasks.classpath"/>
      </taskdef>
  
      <!-- Add ant-contrib tasks -->
      <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
   
      <!-- compile the ant tasks -->
      <mkdir dir="${tools.dir}/anttasks"/>
      <javac srcdir="${tools.dir}/src" 
             destdir="${tools.dir}/anttasks"
             debug="off"
             optimize="on"
             deprecation="on"
             target="1.2"
             nowarn="on"
             classpathref="anttasks.classpath"
             fork="true"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Interactive build                                                   -->
    <!-- =================================================================== -->
    <target name="i" description="Interactive Build" depends="interactive"/>
      
    <target name="interactive" description="Interactive Build">
      <echo message=" "/>   
      <echo message="--------------------------------------------------------------"/>
      <echo message=" "/>    
      <echo message="                        APACHE COCOON "/>
      <echo message=" "/>     
      <echo message="--------------------------------------------------------------"/>
      <echo message="Building with ${ant.version}"/>
      <echo message="using build file ${ant.file}"/>
      <echo message="--------------------------------------------------------------"/>
      <echo message=" "/>    
      <echo message=" These are the most common build targets."/>
      <echo message=" You can also invoke them directly; see build.xml for more info. "/>
      <echo message=" "/>
      <echo message=" installwar ------ installs war package"/>
      <echo message=" installscratchpadwar --- also with scratchpad stuff"/>
      <echo message=" docs ------------ generates the docs"/>
      <echo message=" validate-xdocs -- validation of all core XML documentation"/>
      <echo message=" javadocs -------- generates the API documentation"/>
      <echo message=" printer-docs ---- generates the printer friendly docs"/>
      <echo message=" test ------------ performes all the tests"/>
      <echo message=" compile --------- compiles the source code "/>
      <echo message=" webapp-local ---- local webapp context dir for quick turn around"/>    
      <echo message=" clean ----------- cleans the build directory"/>
      <echo message=" "/>
      <echo message=" "/>
      
      <!-- Ask the user for the destination path for the war -->
      <input message="Please select a target"
             addproperty="input.selection"/>
  
      <!-- If he hits enter, abort -->
      <condition property="do.abort">
        <equals arg1="" arg2="${input.selection}" />
      </condition>
      <fail if="do.abort">Build aborted by user.</fail>
      
      <antcall target="${input.selection}"/>
    </target>
    
    <!-- =================================================================== -->
    <!-- Try other builds that could go into this core build                 -->
    <!-- =================================================================== -->
    <target name="try" depends="init">
      <ant target="${try.task}" antfile="build-t.xml"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Installs Cocoon war file in a specified directory                   -->
    <!-- =================================================================== -->
    <target name="installwar" depends="init"
            description="Installs the WAR package (without the scratchpad) in a specified directory">
  
      <!-- Ask the user for the destination path for the war -->
      <input message="Please select an installation directory"
             addproperty="install.war"/>
  
      <!-- If he hits enter, abort -->
      <condition property="do.abort">
         <equals arg1="" arg2="${install.war}" />
      </condition>
      <fail if="do.abort">Build aborted by user.</fail>
  
      <!-- call install target -->
      <antcall target="install"/>
    </target>
          
    <!-- =================================================================== -->
    <!-- Installs Cocoon war with scratchpad stuff in a specified directory  -->
    <!-- =================================================================== -->
    <target name="installscratchpadwar" depends="init"
            description="Installs the WAR package (with the scratchpad) in a specified directory">
      <echo message=" This contains SCRATCHPAD BUILDS. It is not guaranteed to work."/>
      <echo message=" You have been warned. "/>
    
      <!-- Ask the user for the destination path for the war -->
      <input message="Please select an installation directory"
             addproperty="install.war"/>
  
      <!-- If he hits enter, abort -->
      <condition property="do.abort">
        <equals arg1="" arg2="${install.war}" />
      </condition>
      <fail if="do.abort">Build aborted by user.</fail>
      
      <!-- call install target -->
      <antcall target="install"/>
    </target>
  
    
    <!-- =================================================================== -->
    <!-- Test for optional components                                        -->
    <!-- =================================================================== -->
    <target name="optional-tests" depends="init">
      <echo message="Testing for optional components"/>
  
      <available classpathref="classpath"
                 property="jaxen.present" 
                 classname="org.jaxen.dom.XPath"/>
  
      <available classpathref="classpath"
                 property="ifx.driver.present" 
                 classname="com.informix.jdbc.IfxResultSet"/>
  
      <available classpathref="classpath"
                 property="poi.proper.present" 
                 classname="org.apache.poi.poifs.common.POIFSConstants"/>
                      
      <available classpathref="classpath"
                 property="commons.logging.present" 
                 classname="org.apache.commons.logging.LogFactory"/>     
                      
      <condition property="poi.present">
       <and> <!-- with post 1.4.1 Ant use <isset property="poi.proper.present"/> -->
        <not>
          <equals arg1="${poi.proper.present}" arg2="$${poi.proper.present}" />
        </not>
        <not> <!-- with post 1.4.1 Ant use <isset property="commons.logging.present"/> -->
          <equals arg1="${commons.logging.present}" arg2="$${commons.logging.present}" />
        </not>
       </and>
      </condition>
      
      <available classpathref="classpath"
                 property="pizza.present" 
                 classname="net.sf.pizzacompiler.compiler.Main"/>
  
      <available classpathref="classpath" 
                 property="xmldb.present" 
                 classname="org.xmldb.api.DatabaseManager"/>
  
      <available classpathref="classpath" 
                 property="xindice.present" 
                 classname="org.apache.xindice.client.xmldb.DatabaseImpl"/>
  
      <available classpathref="classpath" 
                 property="jfor.present" 
                 classname="org.jfor.jfor.converter.Converter"/>
  
      <available classpathref="classpath" 
                 property="servlet.present" 
                 classname="javax.servlet.http.HttpServlet"/>
  
      <available classpathref="classpath" 
                 property="servlet23.present" 
                 classname="javax.servlet.http.HttpServletRequestWrapper"/>
  
      <available classpathref="classpath"
                 property="bsf.present" 
                 classname="com.ibm.bsf.BSFException"/>
  
      <available classpathref="classpath"
                 property="rhino.compiler.present" 
                 classname="org.mozilla.javascript.tools.jsc.Main"/>
  
      <available classpathref="classpath"
                 property="rhino.interpreter.present" 
                 classname="org.mozilla.javascript.Context"/>
  
      <available classpathref="classpath"
                 property="python.present" 
                 classname="org.python.core.Py"/>
  
      <available classpathref="classpath"
                 property="jstyle.present" 
                 classname="jstyle.JSFormatter"/>
  
      <available classpathref="classpath"
                 property="xpath.present" 
                 classname="org.apache.xpath.XPathAPI"/>
  
      <available classpathref="classpath"
                 property="deli.present" 
                 classname="com.hp.hpl.deli.Profile"/>
  
      <available classpathref="classpath"
                 property="velocity.present" 
                 classname="org.apache.velocity.app.Velocity"/>
  
      <available classpathref="classpath"
                 property="resolver.present" 
                 classname="org.apache.xml.resolver.Resolver"/>
  
      <available classpathref="classpath"
                 property="ora.driver.present" 
                 classname="oracle.jdbc.OracleResultSet"/>
  
      <available classpathref="classpath"
                 property="mail.present" 
                 classname="javax.mail.Session"/>
  
      <available classpathref="classpath"
                 property="weblogic.present" 
                 classname="weblogic.servlet.internal.ServletContextImpl"/>
  
      <available classpathref="classpath"
                 property="jdbc3.present" 
                 classname="java.sql.Savepoint"/>
  
      <available classpathref="classpath" 
                 property="php.present" 
                 classname="net.php.servlet"/>
  
      <available classpathref="classpath" 
                 property="naming.present" 
                 classname="javax.naming.Context"/>
  
      <available classpathref="classpath" 
                 property="svg.present" 
                 classname="org.apache.batik.transcoder.Transcoder"/>
  <!--
      <available classpathref="classpath" 
                 property="fop.present" 
                 classname="org.apache.fop.apps.Driver"/>
  -->
      <available classpathref="classpath" 
                 property="tidy.present" 
                 classname="org.w3c.tidy.Tidy"/>
  
      <available classpathref="classpath" 
                 property="maybeupload.present" 
                 classname="uk.co.weft.maybeupload.MaybeUploadRequestWrapper"/>
  
      <available classpathref="classpath" 
                 property="lucene.present" 
                 classname="org.apache.lucene.search.Searcher"/>
  
      <available classpathref="classpath" 
                 property="hsqldb.present" 
                 classname="org.hsqldb.Server"/>
  
      <available classpathref="classpath" 
                 property="jisp.present" 
                 classname="com.coyotegulch.jisp.IndexedObjectDatabase"/>
  
      <available classpathref="classpath" 
                 property="jxpath.present" 
                 classname="org.apache.commons.jxpath.JXPathContext"/>
     
      <available classpathref="classpath" 
                 property="httpclient.present" 
                 classname="org.apache.commons.httpclient.HttpClient"/>
  
      <available classpathref="classpath" 
                 property="activation.present" 
                 classname="javax.activation.DataSource"/>
  
      <available classpathref="classpath" 
                 property="mail.present" 
                 classname="javax.mail.message"/>
    </target>
    
    <!-- =================================================================== -->
    <!-- Macro for optional warnings                                         -->
    <!-- =================================================================== -->
    <target name="op-warning" unless="omit.opt.warnings">
      <echo>**********************************************</echo>
      <echo>*</echo>
      <echo>*  Classes of the optional package ${thing} are not </echo>
      <echo>*  available. ${fullname} builds without them.</echo>
      <echo>*</echo>
      <echo>*  ${message}</echo>
      <echo>*</echo>
      <echo>*  Recovery:</echo>
      <echo>*  ${recovery}</echo>
      <echo>*</echo>    
      <echo>***********************************************</echo>
    </target>
    
    <!-- =================================================================== -->
    <!-- Warnings                                                            -->
    <!-- =================================================================== -->
    
    <!-- Outputs a warning if com.ibm.bsf.* classes are missing during compilation -->
    <target name="bsf-warn" unless="bsf.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="BSF"/>
        <param name="recovery" 
          value="Get the BSF package from http://oss.software.ibm.com/developerworks/projects/bsf/ and place the jar in the lib/optional dir"/>
        <param name="message" 
               value="BSF is required for the script action."/>
      </antcall>
    </target>  
    
    <!-- Outputs a warning if org.mozilla.javascript.* classes are missing during compilation -->
    <target name="rhino-warn" unless="rhino.interpreter.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Rhino"/>
        <param name="recovery" 
          value="Get the Rhino package from http://www.mozilla.org/rhino/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Rhino is required for the scripts and XSP in Javascript."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.python.* classes are missing during compilation -->
    <target name="python-warn" unless="python.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="jython"/>
        <param name="recovery" 
          value="Get the jython package from http://www.jython.org/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Jython is required for the scripts in Python."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.jfor.jfor.* classes are missing during compilation -->
    <target name="jfor-warn" unless="jfor.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="JFOR"/>
        <param name="recovery" 
          value="Get the JFOR package from http://www.jfor.org/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="JFOR is required for the fo2rtf serializer."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.xmldb.api.* classes are missing during compilation -->
    <target name="xmldb-warn" unless="xmldb.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="XMLDB"/>
        <param name="recovery" 
          value="Get the xmldb package from http://www.xmldb.org/xapi/ and place the xmldb-api jar in the lib/optional dir"/>
        <param name="message"
               value="XMLDB is required for the xmldb and xmldbcollection generator."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if net.php.* classes are missing during compilation -->
    <target name="php-warn" unless="php.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="PHP"/>
        <param name="recovery" 
          value="Get the PHP servlet (phpsrvlt.jar) from http://www.php.net/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="PHP is required for the php generator."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if javax.naming.* classes are missing during compilation -->
    <target name="naming-warn" unless="naming.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="JNDI"/>
        <param name="recovery" 
          value="Get the jndi.jar from Sun and place the jar in the lib/optional dir"/>
        <param name="message"
               value="JNDI is required for the ldap generator and the parentcm generator."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.apache.batik.* classes are missing during compilation -->
    <target name="svg-warn" unless="svg.present" depends="optional-tests"> 
      <antcall target="op-warning">
        <param name="thing" value="Batik"/>
        <param name="recovery" 
          value="Get Batik from http://xml.apache.org/batik/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Batik is required for the svg serializers."/>
      </antcall>
    </target>
  
    <!-- Outputs a warning if org.apache.fop.* classes are missing during compilation -->
  <!--  
    <target name="fop-warn" unless="fop.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="FOP"/>
        <param name="recovery" 
          value="Get FOP from http://xml.apache.org/fop/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="FOP is required for the fo2pdf, fo2ps and fo2pcl serializer."/>
      </antcall>
    </target>
  -->  
    <!-- Outputs a warning if org.w3c.tidy.* classes are missing during compilation -->
    <target name="tidy-warn" unless="tidy.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="JTidy"/>
        <param name="recovery" 
          value="Get JTidy from http://sourceforge.net/projects/jtidy/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="JTidy is required for the html generator."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if uk.co.weft.maybeupload.* classes are missing during compilation -->
    <target name="maybeupload-warn" unless="maybeupload.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="MaybeUpload"/>
        <param name="recovery" 
          value="Get MaybeUpload from http://www.weft.co.uk/library/maybeupload/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="MaybeUpload simplifies the handling of uploaded files."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.apache.lucene.* classes are missing during compilation -->
    <target name="lucene-warn" unless="lucene.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Lucene"/>
        <param name="recovery" 
          value="Get Lucene from http://jakarta.apache.org/lucene/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Lucene is required for the Cocoon searches."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if com.hp.hpl.deli.* classes are missing during compilation -->
    <target name="deli-warn" unless="deli.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Deli"/>
        <param name="recovery" 
          value="Get Deli and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Deli is required for ..."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.apache.velocity.* classes are missing during compilation -->
    <target name="velocity-warn" unless="velocity.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Velocity"/>
        <param name="recovery" 
          value="Get Velocity from http://jakarta.apache.org/velocity/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Velocity is required for the velocity generator."/>
      </antcall>
    </target>
    
    <!-- Outputs a warning if org.hsqldb.* classes are missing during compilation -->
    <target name="hsqldb-warn" unless="hsqldb.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="hsqldb"/>
        <param name="recovery" 
          value="Get hsqldb from http://hsqldb.sourceforge.net/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="hsqldb is required for the sql examples."/>
      </antcall>
    </target>
  
    <!-- Outputs a warning if org.apache.xml.resolver.* classes are missing during compilation -->
    <target name="resolver-warn" unless="resolver.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Resolver"/>
        <param name="recovery" 
          value="Get the resolver package from xml-commons CVS and place the jar in the lib/optional dir"/>
        <param name="message"
               value="The resolver allows entity resolving."/>
      </antcall>
    </target>
  
    <!-- Outputs a warning if com.coyotegulch.jisp.* classes are missing during compilation -->
    <target name="jisp-warn" unless="jisp.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="jisp"/>
        <param name="recovery"
          value="Get the jisp package from http://www.coyotegulch.com/jisp/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="jisp is required for the JispFilesystemStore."/>
      </antcall>
    </target>
  
    <!-- Outputs a warning if net.sf.pizzacompiler.compiler.* classes are missing during compilation -->
    <target name="pizza-warn" unless="pizza.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Pizza"/>
        <param name="recovery"
          value="Get the pizza package from http://pizzacompiler.sourceforge.net/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Pizza is the alternative Java compiler."/>
      </antcall>
    </target>
  
    <!-- Outputs a warning if org.apache.poi.* classes are missing during compilation -->
    <target name="poi-warn" unless="poi.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="POI"/>
        <param name="recovery" 
          value="Get the POI package from http://jakarta.apache.org/poi/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="POI is required for the POI sitemap components."/>
      </antcall>
    </target>  
  
    <!-- Outputs a warning if org.apache.commons.logging.* classes are missing during compilation -->
    <target name="commons-logging-warn" unless="commons.logging.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Jakarta Commons Logging"/>
        <param name="recovery" 
          value="Get the Jakarta Commons Logging package from http://jakarta.apache.org/commons/logging/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="The Jakarta Commons Logging package is required for the POI sitemap components."/>
      </antcall>
    </target>  
    
    <!-- Outputs a warning if org.apache.commons.jxpath.* classes are missing during compilation -->
    <target name="jxpath-warn" unless="jxpath.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="JXPath"/>
        <param name="recovery" 
          value="Get the JXPath package and place the jar in the lib/optional dir"/>
        <param name="message"
               value="The JXPath package is required for ...."/>
      </antcall>
    </target>  
       
    <!-- Outputs a warning if org.apache.commons.httpclient.* classes are missing during compilation -->
    <target name="httpclient-warn" unless="httpclient.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="HTTPClient"/>
        <param name="recovery" 
          value="Get the HTTP client package and place the jar in the lib/optional dir"/>
        <param name="message"
               value="The HTTP client package is required for ...."/>
      </antcall>
    </target>  
  
    <!-- Outputs a warning if javax.activation.* classes are missing during compilation -->
    <target name="activation-warn" unless="activation.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Activation"/>
        <param name="recovery" 
          value="Get the SUN Activation package and place the jar in the lib/local dir"/>
        <param name="message"
               value="The SUN Activation package is required for the AxisRPCReader class"/>
      </antcall>
    </target>  
  
    <!-- Outputs a warning if javax.mail.Message class is missing during compilation -->
    <target name="mail-warn" unless="mail.present" depends="optional-tests">
      <antcall target="op-warning">
        <param name="thing" value="Mail"/>
        <param name="recovery" 
          value="Get the mail package from http://java.sun.com/products/javamail/ and place the jar in the lib/optional dir"/>
        <param name="message"
               value="Mail is required for the Mail action."/>
      </antcall>
    </target>
    
    <!-- =================================================================== -->
    <!-- Print out warnings for optional components                          -->
    <!-- =================================================================== -->
    <target name="optional-warnings" 
            depends="bsf-warn, rhino-warn, jfor-warn, xmldb-warn, php-warn, naming-warn, svg-warn, tidy-warn, maybeupload-warn, lucene-warn, deli-warn, velocity-warn, hsqldb-warn, resolver-warn, jisp-warn, pizza-warn, poi-warn, commons-logging-warn, jxpath-warn, httpclient-warn, activation-warn, mail-warn">
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the build directory                                        -->
    <!-- =================================================================== -->
    <target name="prepare" depends="init, optional-tests, optional-warnings">
      <mkdir dir="${build.dir}"/>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Prepares the source code                                            -->
    <!-- =================================================================== -->
    <target name="prepare-src-main" depends="prepare, generate-java-code, -copy-deprecated-stuff2core">
      <mkdir dir="${build.src}"/>
      <mkdir dir="${build.dest}"/>
      <copy todir="${build.src}" filtering="on">
            
        <fileset dir="${java.dir}">
        
  <!-- present in lib/optional
          <exclude name="**/java/Pizza.java"         unless="pizza.present"/>
          <exclude name="**/java/pizza.*"            unless="pizza.present"/>
          <exclude name="**/java/javac.*"            if="pizza.present"/>
  
          <exclude name="**/servlet.*"               unless="servlet.present"/>
          <exclude name="**/deli/DeliImpl.java"      unless="servlet.present"/>
          <exclude name="**/servlet/*.java"          unless="servlet.present"/>
          <exclude name="**/environment/http/*.java" unless="servlet.present"/>
          <exclude name="**/generation/StreamGenerator.java" unless="servlet.present"/>
          <exclude name="**/components/request/**"   unless="servlet.present"/>
  
          <exclude name="**/deli/DeliImpl.java"      unless="deli.present"/>
          <exclude name="**/deli.*"                  unless="deli.present"/>
  
          <exclude name="**/CompiledJavascript*"     unless="rhino.compiler.present"/>
          <exclude name="**/javascript/Javascript*"  unless="rhino.interpreter.present"/>
          <exclude name="**/javascript/javascript*"  unless="rhino.interpreter.present"/>
          <exclude name="**/xsp/JSGenerator.java"    unless="rhino.interpreter.present"/>
          <exclude name="**/xsp/javascript/**"       unless="rhino.interpreter.present"/>
          <exclude name="**/flow/javascript/**"      unless="rhino.interpreter.present"/>
  
          <exclude name="**/components/resolver/ResolverImpl.java" unless="resolver.present"/>
          <exclude name="**/resolver.*"                            unless="resolver.present"/>
  
          <exclude name="**/Jstyle*"             unless="jstyle.present"/>
  
          <exclude name="**/XMLDB*.java"        unless="xmldb.present"/>
          <exclude name="**/DbXML*.java"        unless="xmldb.present"/>
  -->
          <exclude name="**/source/xmldb.*"     unless="xindice.present"/>
          <exclude name="**/generation/xmldb.*" unless="xindice.present"/>
  <!--
          <exclude name="**/RTFSerializer.java" unless="jfor.present"/>
          <exclude name="**/jfor.*"             unless="jfor.present"/>
  
          <exclude name="**/xpath/XPathProcessorImpl*" unless="xpath.present"/>
          <exclude name="**/xpath/JaxenProcessorImpl*" unless="jaxen.present"/>
  
          <exclude name="**/components/hsqldb/ServerImpl.java" unless="hsqldb.present"/>
          <exclude name="**/hsqldb.*"                          unless="hsqldb.present"/>
  
          <exclude name="**/components/store/Jisp*.java" unless="jisp.present"/>
          <exclude name="**/store/jisp.*"                unless="jisp.present"/>
  
          <exclude name="**/components/xmlform/**"    unless="jxpath.present"/>
          <exclude name="**/samples/xmlform/**"       unless="jxpath.present"/>
          <exclude name="**/acting/**XMLForm**"       unless="jxpath.present"/>
          <exclude name="**/transformation/**XMLForm**"       unless="jxpath.present"/>
          <exclude name="**/components/validation/**" unless="jxpath.present"/>
  
          <exclude name="**/WebServiceProxyGenerator.java" unless="httpclient.present"/>
          <exclude name="**/xsp/SOAPHelper.java"           unless="httpclient.present"/>
  
          <exclude name="**/MaybeUpload*.java"           unless="maybeupload.present"/>
          <exclude name="**/http/RequestWrapper*.java"/>
          <exclude name="**/browser/*.x*"/>
  -->
  
          <!-- Do not use FilesystemStore, it's broken. Unless you have to. -->
          <exclude name="**/store/file.*"                if="jisp.present"/>
        </fileset>
      </copy>
  
      <if>
        <istrue value="${cocoon.webapp.scratchpad.include}"/>
        <then>
          <mkdir dir="${build.scratchpad.src}"/>
          <mkdir dir="${build.scratchpad.dest}"/>
          <copy todir="${build.scratchpad.src}" filtering="on">
            <fileset dir="${scratchpad.src}">
              <exclude name="**/Ifx*.java" unless="ifx.driver.present"/>
      
              <exclude name="**/components/request/**"                unless="servlet.present"/>
              <exclude name="**/precept/**"                           unless="servlet.present"/>
              <exclude name="**/reading/ByteRangeResourceReader.java" unless="servlet.present"/>
              <exclude name="**/acting/SourceMultiAction.java"        unless="servlet.present"/>
              <exclude name="**/acting/SourceUploadAction.java"       unless="servlet.present"/>
              <exclude name="**/generation/RequestAttribute**.java"   unless="servlet.present"/>
      
              <exclude name="**/jxpath/**" unless="jxpath.present"/>
              <exclude name="**/taglib/**" unless="jxpath.present"/>
              <exclude name="**/transformation/TagTransformer.java" unless="jxpath.present"/>
      
              <exclude name="**/XMLDB*.java" unless="xmldb.present"/>
              <exclude name="**/DbXML*.java" unless="xmldb.present"/>
      
              <exclude name="**/servlet/*Filter*.java" unless="servlet23.present"/>
      
              <exclude name="**/components/axis/**" unless="activation.present"/>
              <exclude name="**/reading/AxisRPCReader.java" unless="activation.present"/>
              <exclude name="**/webservices/**" unless="activation.present"/>
      
              <exclude name="**/mail/**" unless="mail.present"/>
            </fileset>
          </copy>
        </then>
      </if>
      
      <mkdir dir="${build.deprecated.src}"/>
      <mkdir dir="${build.deprecated.dest}"/>
      <copy todir="${build.deprecated.src}" filtering="on">
        <fileset dir="${deprecated.src}">
          <include name="**/*.java"/>
        </fileset>
      </copy>
    </target>
  
    <!-- INCLUDE DEPRECATED CLASSES TILL DEPENDENCIES ON THEM ARE FIXED      -->
    <target name="-copy-deprecated-stuff2core" depends="init" unless="deprecate">
      <copy todir="${build.src}" filtering="on">
        <fileset dir="${deprecated.src}">
          <include name="**/*.java"/>
        </fileset>
      </copy>
    </target>
  
    <!-- Set a variable if the generated java code is already up-to-date.    -->
    <target name="generate-java-code-check" depends="init">
      <uptodate property="generate-java-code.notrequired"
          targetfile="${build.src}/org/apache/cocoon/components/browser/BrowserImpl.java" >
        <srcfiles dir="${java.dir}/org/apache/cocoon/components/browser"
            includes="BrowserImpl.xml,BrowserImpl.xsl"/>
      </uptodate>
    </target>
  
    <!-- Generate the Java code from XML using XSLT                          -->
    <target name="generate-java-code" depends="generate-java-code-check"
            unless="generate-java-code.notrequired">
      <xslt basedir="${java.dir}/org/apache/cocoon/components/browser"
             destdir="${build.src}/org/apache/cocoon/components/browser"
             includes="BrowserImpl.xml"
             extension=".java"
             style="${java.dir}/org/apache/cocoon/components/browser/BrowserImpl.xsl"/>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Compiles the source directory                                       -->
    <!-- =================================================================== -->
    <target name="compile-core" depends="prepare-src-main"
            description="Compiles the source code">
      <copy todir="${build.dest}">
        <fileset dir="${build.src}">
          <include name="**/Manifest.mf"/>
          <include name="**/*.xsl"/>
          <include name="**/*.roles"/>
          <include name="**/*.xml"/>
          <include name="**/*.js"/>
          <include name="**/*.scm"/>
          <include name="META-INF/**"/>
        </fileset>
      </copy>
  
      <!-- A task to change the roles file. It is used to add optional components -->
      <taskdef name="roles-tool" classname="XConfToolTask" 
               classpath="${tools.dir}/anttasks"/>
  
      <!-- Invoke the XConfTool to add optional roles for components -->
      <roles-tool directory="${build.src}"
                  extension="xroles"
                  configuration="${build.dest}/org/apache/cocoon/cocoon.roles"/>
  
      <echo message="Compiling with Java ${ant.java.version}, debug ${debug}, optimize ${optimize}, deprecation ${deprecation}"/>
  
      <mkdir dir="${build.mocks}"/>
      <javac srcdir="${mocks.dir}"
             destdir="${build.mocks}"
             debug="${debug}"
             optimize="${optimize}"
             deprecation="${deprecation}"
             target="${target.vm}"
             nowarn="${nowarn}"
             fork="true">
        <classpath refid="classpath"/>
      </javac>
  
      <javac srcdir="${build.src}"
             destdir="${build.dest}"
             debug="${debug}"
             optimize="${optimize}"
             deprecation="${deprecation}"
             target="${target.vm}"
             nowarn="${nowarn}"
             fork="true">
        <!--classpath refid="classpath"/-->
        <classpath>
          <path refid="classpath"/>
          <path location="${build.mocks}"/>
        </classpath>
      </javac>
  
      <if>
        <istrue value="${cocoon.webapp.scratchpad.include}"/>
        <then>
          <copy todir="${build.scratchpad.dest}">
            <fileset dir="${build.scratchpad.src}">
              <include name="**/Manifest.mf"/>
              <include name="**/*.xsl"/>
              <include name="**/*.wsdd"/>
              <include name="**/*.roles"/>
              <include name="META-INF/**"/>
            </fileset>
          </copy>
  
          <javac srcdir="${build.scratchpad.src}"
                 destdir="${build.scratchpad.dest}"
                 debug="${debug}"
                 optimize="${optimize}"
                 deprecation="${deprecation}"
                 target="${target.vm}"
                 fork="true">
            <!--classpath refid="scratchpad.classpath"/-->
            <classpath>
              <path refid="scratchpad.classpath"/>
              <path location="${build.mocks}"/>
            </classpath>
          </javac>
        </then>
      </if>    
  
      <copy todir="${build.deprecated.dest}">
        <fileset dir="${build.deprecated.src}">
          <include name="**/Manifest.mf"/>
          <include name="**/*.xsl"/>
          <include name="**/*.wsdd"/>
          <include name="**/*.roles"/>
          <include name="META-INF/**"/>
        </fileset>
      </copy>
  
      <javac srcdir="${build.deprecated.src}"
             destdir="${build.deprecated.dest}"
             debug="${debug}"
             optimize="${optimize}"
             deprecation="${deprecation}"
             target="${target.vm}"
             fork="true">
        <!--classpath refid="scratchpad.classpath"/-->
        <classpath>
          <path refid="scratchpad.classpath"/>
          <path location="{build.mocks}"/>
        </classpath>
      </javac>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Compiles the Java files in the src/samples/ directory               -->
    <!-- =================================================================== -->
    <target name="compile-samples" depends="init">
      <property name="build.dest.samples" value="${build.dest}/samples"/>
  
      <mkdir dir="${build.dest.samples}"/>
      <javac srcdir="${webapp.dir}/samples"
         destdir="${build.dest}"
         excludes="chaperon/**"
         debug="${debug}"
         optimize="${optimize}"
         deprecation="${deprecation}"
         target="${target.vm}"
         fork="true">
        <classpath refid="classpath"/>
      </javac>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Creates the core Cocoon jar file                                    -->
    <!-- =================================================================== -->
    <target name="package-core" depends="compile-core" description="Generates the core Cocoon jar package">
      <jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
        <fileset dir="${build.dest}">
          <include name="org/**"/>
          <include name="META-INF/**"/>
          <exclude name="org/apache/cocoon/samples/**"/>
        </fileset>
      </jar>
  
      <if>
        <istrue value="${cocoon.webapp.scratchpad.include}"/>
        <then>
          <jar jarfile="${build.dir}/${scratchpad.name}.jar">
            <fileset dir="${build.scratchpad.dest}">
              <include name="org/**"/>
            </fileset>
          </jar>
        </then>
      </if>
      
      <jar jarfile="${build.dir}/${deprecated.name}.jar">
        <fileset dir="${build.deprecated.dest}">
          <include name="org/**"/>
        </fileset>
      </jar>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Compile also all blocks that are specified in properties.xml        -->
    <!-- =================================================================== -->
    <target name="compile" depends="package-core">
      <property name="compile.project" value="all"/>
      
      <delete file="${build.work}/blocks-build.xml"/>
      
      <xslt in="project-info.xml" 
            out="${build.work}/blocks-build.xml"
            processor="trax"
            style="${tools.dir}/src/blocks-build.xsl"/>
             
      <ant antfile="${build.work}/blocks-build.xml" 
           inheritAll="true" 
           inheritRefs="true"
           target="${compile.project}"/>
      
      <!-- FIXME: We have to rebuild the cocoon.jar in order to
                  add the roles defined in the blocks -->
      <jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
        <fileset dir="${build.dest}">
          <include name="org/**"/>
          <include name="META-INF/**"/>
          <exclude name="org/apache/cocoon/samples/**"/>
        </fileset>
      </jar>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Default target compiles and packages Cocoon and all blocks          -->
    <!-- =================================================================== -->
    <target name="all" depends="compile" description="Default target (calls the 'compile' target)"/>
  
  
    <!-- =================================================================== -->
    <!-- Creates the samples jar file                                        -->
    <!-- =================================================================== -->
    <target name="package-samples" depends="compile-samples">
      <jar jarfile="${build.dir}/${name}-samples.jar">
        <fileset dir="${build.dest}">
          <include name="samples/**"/>
        </fileset>
      </jar>
    </target>
  
    <!-- =================================================================== -->
    <!-- Target called by Gump                                                -->
    <!-- =================================================================== -->
    <target name="gump" depends="docs, javadocs, test, package-core" description="[admin] Target called by Gump"/>
    
    <!-- =================================================================== -->
    <!-- Prepares the docs                                                   -->
    <!-- =================================================================== -->
    <target name="prepare-docs" depends="check-jars">
      <mkdir dir="${build.context}"/>
      <mkdir dir="${build.context}/images"/>
      <mkdir dir="${build.docs}"/>
      <mkdir dir="${build.work}"/>
  
      <!-- make filtered copy of XML docs -->
      <copy todir="${build.context}" filtering="on">
        <fileset dir="${context.dir}">
          <exclude name="images/**"/>
        </fileset>
      </copy>
  
      <!-- Add changes and todo -->
      <copy file="changes.xml" tofile="${build.context}/xdocs/changes.xml" filtering="on"/>
      <copy file="todo.xml"    tofile="${build.context}/xdocs/todo.xml" filtering="on"/>
  
      <replace file="${build.context}/xdocs/changes.xml"
               token="src/documentation/xdocs/dtd/" value="dtd/"/>
      <replace file="${build.context}/xdocs/todo.xml"
               token="src/documentation/xdocs/dtd/" value="dtd/"/>
  
      <copy file="${build.dir}/jars.xml"
            tofile="${build.context}/xdocs/installing/jars.xml" filtering="off" overwrite="yes"/>
  
      <!-- Copy images -->
      <copy todir="${build.context}/images" filtering="off">
        <fileset dir="${context.dir}/images"/>
      </copy>
  
      <!-- Copy entity catalog and entities -->
      <copy todir="${build.context}/WEB-INF/entities" filtering="on">
        <fileset dir="${webapp.dir}/WEB-INF/entities"/>
      </copy>
      <copy todir="${build.context}/WEB-INF/classes" filtering="on">
        <fileset dir="${webapp.dir}/WEB-INF/classes"/>
      </copy>
      <copy todir="${build.context}" filtering="on" file="${webapp.dir}/WEB-INF/logkit.xconf">
      </copy>    
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Set a variable if the generated docs are already up-to-date.        -->
    <!-- =================================================================== -->
    <target name="docs_check" depends="prepare-docs">
      <uptodate property="docs.notrequired" targetfile="${build.docs}/index.html" >
        <srcfiles dir="." includes="changes.xml,todo.xml"/>
        <srcfiles dir="${build.dir}" includes="jars.xml"/>
        <srcfiles dir="${context.dir}/xdocs" includes="**/*.xml"/>
      </uptodate>
    </target>
  
    <!-- =================================================================== -->
    <!-- If generated  docs is already up-to-date, print a message saying so. -->
    <!-- =================================================================== -->
    <target name="docs_done" depends="docs_check" if="docs.notrequired">
      <echo message="-------------------------------------------------------------"/>
      <echo message="Not rebuilding docs, as they are up-to-date:"/>
      <echo message="  ${build.docs}/index.html is more recent than"/>
      <echo message="  todo.xml, changes.xml, ${context.dir}/xdocs/*.xml"/>
      <echo message="-------------------------------------------------------------"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- The documentation system                                            -->
    <!-- =================================================================== -->
    <target name="docs"
            depends="compile, prepare-docs, validate-xdocs, docs_done"
            unless="docs.notrequired"
            description="Builds the documentation">
      <java classname="org.apache.cocoon.Main" fork="true" dir="${build.context}"
            failonerror="true" maxmemory="128m">
        <arg value="-c."/>
        <arg value="-d../docs"/>
        <arg value="-w../work"/>
        <arg value="-b../brokenlinks.txt"/>
        <arg value="-k../documentation/logkit.xconf"/>
        <arg value="-u${build.docs.loglevel}"/>
        <arg value="-V"/>
        <arg value="index.html"/>
        <classpath>
          <path refid="classpath"/>
          <fileset dir="${build.dir}">
            <include name="*.jar"/>
          </fileset>
          <pathelement location="${tools.jar}"/>
          <pathelement location="${build.context}/WEB-INF/classes"/>
        </classpath>
      </java>
    </target>
  
    <!-- =================================================================== -->
    <!-- Set a variable if the generated docs are already up-to-date.        -->
    <!-- =================================================================== -->
    <target name="docs_clean" depends="init">
      <delete dir="${build.context}/../docs"/>
    </target>
    
    <!-- =================================================================== -->
    <!-- Copies the webapp directories                                       -->
    <!-- =================================================================== -->
    <target name="copy-webapp" depends="prepare-docs, prepare, compile">
      <mkdir dir="${build.war}"/>
  
      <mkdir dir="${build.war}/WEB-INF/classes"/>
      <copy todir="${build.war}/WEB-INF/classes" filtering="off">
        <fileset dir="${build.dest}" includes="org/apache/cocoon/samples/**"/>
        <fileset dir="${build.src}" includes="org/apache/cocoon/samples/**"/>
      </copy>
  
      <copy todir="${build.war}" filtering="on">
        <fileset dir="${webapp.dir}">
          <exclude name="**/*.gif"/>
          <exclude name="**/*.jpg"/>
          <exclude name="**/*.png"/>
          <exclude name="**/i18n/**"/>
          <exclude name="**/db/*"/>
        </fileset>
      </copy>
  
      <copy todir="${build.war}" filtering="off">
        <fileset dir="${webapp.dir}">
          <include name="**/*.gif"/>
          <include name="**/*.jpg"/>
          <include name="**/*.png"/>
          <include name="**/i18n/**"/>
          <include name="**/db/*"/>
        </fileset>
      </copy>
  
      <!-- copy the documentation, it's already prepared in the build context dir -->
      <mkdir dir="${build.war}/documentation"/>
      <copy todir="${build.war}/documentation" filtering="off">
        <fileset dir="${build.context}"/>
      </copy>
  
      <!-- correct the image references -->
      <!-- replace dir="${build.war}/documentation/svg" token="context://images" value="context://documentation/images"/ -->
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the webapp directories                                     -->
    <!-- =================================================================== -->
    <target name="prepare-webapp" depends="copy-webapp">
        <!-- A task to change the xconf. It is used to add optional components -->
        <taskdef name="xconf-tool" classname="XConfToolTask" 
            classpath="${tools.dir}/anttasks"/>
  
        <!-- Invoke the XConfTool to add entries for optional components -->
        <xconf-tool directory="${build.src}"
                    extension="xmap"
                    configuration="${build.war}/sitemap.xmap"/>
  
        <xconf-tool directory="${build.src}"
                    extension="xpipe"
                    configuration="${build.war}/sitemap.xmap"/>
  
        <xconf-tool directory="${build.src}"
                    extension="samplesxpipe"
                    configuration="${build.war}/samples/sitemap.xmap"/>
  
        <xconf-tool directory="${build.src}"
                    extension="xconf"
                    configuration="${build.war}/WEB-INF/cocoon.xconf"/>
  
        <!-- Invoke the XConfTool to add entries for block components -->
        <xconf-tool directory="${build.blocks.root}"
                    extension="xmap"
                    configuration="${build.war}/sitemap.xmap"/>
  
        <xconf-tool directory="${build.blocks.root}"
                    extension="xpipe"
                    configuration="${build.war}/sitemap.xmap"/>
  
        <xconf-tool directory="${build.blocks.root}"
                    extension="samplesxpipe"
                    configuration="${build.war}/samples/sitemap.xmap"/>
  
        <xconf-tool directory="${build.blocks.root}"
                    extension="xconf"
                    configuration="${build.war}/WEB-INF/cocoon.xconf"/>
                    
        <xconf-tool directory="${build.blocks.root}"
                    extension="xsamples"
                    configuration="${build.war}/samples/block-samples.xml"/>
  
        <!-- Invoke the XConfTool to add optional entries for demos -->
        <xconf-tool directory="${build.war}"
                    extension="xpipe"
                    configuration="${build.war}/sitemap.xmap"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the javadocs for webapp                                    -->
    <!-- =================================================================== -->
    <target name="prepare-webapp-javadocs" unless="exclude.javadocs">
      <antcall target="javadocs"/>
      <copy todir="${build.war}/apidocs" filtering="off">
        <fileset dir="${build.javadocs}"/>
      </copy>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the webapp directories for scratchpad                      -->
    <!-- =================================================================== -->
    <target name="prepare-webapp-scratchpad" depends="copy-webapp" unless="exclude.webapp.libs">
      <if>
        <istrue value="${cocoon.webapp.scratchpad.include}"/>
        <then>
            <!-- Invoke the XConfTool to add optional entries -->
            <xconf-tool directory="${build.scratchpad.src}"
                        extension="xmap"
                        configuration="${build.war}/sitemap.xmap"/>
      
            <xconf-tool directory="${build.scratchpad.src}"
                        extension="xpipe"
                        configuration="${build.war}/sitemap.xmap"/>
      
            <xconf-tool directory="${build.scratchpad.src}"
                        extension="xconf"
                        configuration="${build.war}/WEB-INF/cocoon.xconf"/>
      
          <!-- copy scratchpad webapp samples -->
          <copy todir="${build.war}" filtering="on">
            <fileset dir="${scratchpad.webapp}">
              <exclude name="**/*.gif"/>
              <exclude name="**/*.jpg"/>
              <exclude name="**/*.png"/>
           </fileset>
          </copy>
          <copy todir="${build.war}" filtering="off">
            <fileset dir="${scratchpad.webapp}">
              <include name="**/*.gif"/>
              <include name="**/*.jpg"/>
              <include name="**/*.png"/>
           </fileset>
          </copy>
        </then>
      </if>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the libraries for the war package                          -->
    <!-- =================================================================== -->
    <target name="prepare-xsp" depends="package-core" if="build.precompile">
      <java classname="org.apache.cocoon.Main" fork="yes" failonerror="true">
        <arg line="-P -C ${build.war}/WEB-INF/cocoon.xconf -w ${build.war}/WEB-INF/classes -c ${build.war}" />
        <classpath>
          <fileset dir="${lib.dir}/endorsed">
            <include name="**/*.jar"/>
          </fileset>    
          <fileset dir="${lib.dir}/core">
            <include name="**/*.jar"/>
          </fileset>
          <fileset dir="${lib.dir}/core/jvm${target.vm}">
            <include name="*.jar"/>
          </fileset>
          <fileset dir="${lib.dir}/optional">
            <include name="**/*.jar"/>
          </fileset>
          <fileset dir="${lib.dir}/local">
            <include name="**/*.jar"/>
          </fileset>
          <pathelement location="${build.war}/WEB-INF/classes"/>
          <pathelement location="${build.dir}/${name}.jar"/>
          <pathelement location="${tools.jar}"/>
        </classpath>
      </java>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the libraries for the war package                          -->
    <!-- =================================================================== -->
    <target name="copy-webapp-libs" depends="copy-tools-lib, check-jars" unless="exclude.webapp.libs">
      <copy todir="${build.war}/WEB-INF/lib">
        <fileset dir="${lib.dir}/endorsed">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
        <fileset dir="${lib.dir}/core">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
        <fileset dir="${lib.dir}/core/jvm${target.vm}">
          <include name="*.jar"/>
        </fileset>
      </copy>
      <copy todir="${build.war}/WEB-INF/lib">
        <fileset dir="${lib.dir}/optional">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
      </copy>
      <copy todir="${build.war}/WEB-INF/lib">
        <fileset dir="${lib.dir}/local">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
      </copy>
      <copy todir="${build.war}/WEB-INF/lib">
        <fileset dir="${build.dir}">
          <include name="*-block.jar"/>
        </fileset>
        <mapper type="glob" from="*-block.jar" to="cocoon-*-block.jar"/>
      </copy>    
    </target>
  
    <target name="prepare-webapp-libs" depends="package-core, package-samples, copy-webapp-libs" unless="exclude.webapp.libs">
      <copy file="${build.dir}/${name}.jar" tofile="${build.war}/WEB-INF/lib/${name}-${version}.jar"/>
      <copy file="${build.dir}/${name}-samples.jar"
        todir="${build.war}/WEB-INF/lib/"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the scratchpad libraries for the war package               -->
    <!-- =================================================================== -->
    <target name="copy-scratchpad-libs" depends="copy-webapp-libs" unless="exclude.webapp.libs">
      <if>
        <istrue value="${cocoon.webapp.scratchpad.include}"/>
        <then>
          <copy todir="${build.war}/WEB-INF/lib">
            <fileset dir="${scratchpad.lib}">
              <include name="*.jar"/>
              <exclude name="servlet*.jar"/>
            </fileset>
          </copy>
        </then>
      </if>
    </target>
  
    <target name="prepare-scratchpad-libs" depends="copy-scratchpad-libs, prepare-webapp-libs" unless="exclude.webapp.libs">
      <if>
        <istrue value="${cocoon.webapp.scratchpad.include}"/>
        <then>
          <copy file="${build.dir}/${scratchpad.name}.jar" tofile="${build.war}/WEB-INF/lib/${scratchpad.name}.jar"/>
        </then>
      </if>
    </target>
  
    <!-- =================================================================== -->
    <!-- Copies the tools.jar to javac.jar in web-inf/lib                    -->
    <!-- =================================================================== -->
    <target name="copy-tools-lib" depends="copy-webapp" if="tools.jar.present" unless="pizza.present">
      <!-- NOTE: java.home is normally set by the JVM to the /jre directory  -->
      <copy file="${tools.jar}" tofile="${build.war}/WEB-INF/lib/javac.jar"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepare the war file                                                -->
    <!-- =================================================================== -->
    <target name="prepare-war" depends="prepare-webapp, validate-config, validate-xdocs, prepare-webapp-javadocs, prepare-webapp-scratchpad, prepare-webapp-libs, prepare-scratchpad-libs, prepare-xsp" description="Prepares the war package">
    </target>
  
    <!-- =================================================================== -->
    <!-- Creates the war file                                                -->
    <!-- =================================================================== -->
    <target name="webapp" depends="prepare-war" description="Builds the war package">
      <!-- A task to create manifest for webapp. -->
      <taskdef name="manifest" classname="ManifestToolTask" 
               classpath="${tools.dir}/anttasks"/>
  
      <manifest directory="${build.war}/WEB-INF/lib"
                manifest="${build.war}/WEB-INF/Manifest.mf"/>
  
      <!-- Compatible testing of 'obsolete' exclude.webapp.samples and
           new property cocoon.webapp.samples.include -->
      <condition property="exclude.samples.from.webapp" value="true">
        <or>
          <isfalse value="${cocoon.webapp.samples.include}"/>
          <isset   property="exclude.webapp.samples"/>
        </or>
      </condition>
  
      <!-- Compatible testing of 'obsolete' exclude.webapp.documentation and
           new property cocoon.webapp.documentation .include -->
      <condition property="exclude.documentation.from.webapp" value="true">
        <or>
          <isfalse value="${cocoon.webapp.documentation.include}"/>
          <isset   property="exclude.webapp.documentation"/>
        </or>
      </condition>
  
      <!-- Compatible testing of 'obsolete' exclude.webapp.javadocs and
           new property cocoon.webapp.javadocs.include -->
      <condition property="exclude.javadocs.from.webapp" value="true">
        <or>
          <isfalse value="${cocoon.webapp.javadocs.include}"/>
          <isset   property="exclude.webapp.javadocs"/>
        </or>
      </condition>
  
      <jar jarfile="${build.dir}/${name}.war"
           manifest="${build.war}/WEB-INF/Manifest.mf">
        <fileset dir="${build.war}">
          <exclude name="samples/**"       if="exclude.samples.from.webapp"/>
          <exclude name="documentation/**" if="exclude.documentation.from.webapp"/>
          <exclude name="apidocs/**"       if="exclude.javadocs.from.webapp"/>
        </fileset>
      </jar>
      <jar jarfile="${build.dir}/${name}-webapp-samples.jar">
        <fileset dir="${build.war}">
           <include name="samples/**"/>
        </fileset>
      </jar>
      <jar jarfile="${build.dir}/${name}-webapp-docs.jar">
        <fileset dir="${build.war}">
           <include name="documentation/**"/>
           <include name="apidocs/**"/>
        </fileset>
      </jar>
    </target>
  
    <!-- =================================================================== -->
    <!-- Creates a clean war file                                            -->
    <!-- =================================================================== -->
    <target name="clean-webapp" description="Builds the clean war package">
        <property name="exclude.webapp.samples"       value="true"/>
        <property name="exclude.webapp.documentation" value="true"/>
        <property name="exclude.webapp.javadocs"      value="true"/>
        <property name="exclude.webapp.libs"          value="false"/>
        <antcall target="webapp"/>
    </target>
   
    <!-- =================================================================== -->
    <!-- Creates a local webapp directly useable as a servlet context        -->
    <!-- =================================================================== -->
    <target name="webapp-local" depends="prepare-webapp, prepare-webapp-scratchpad, validate-config, validate-xdocs, copy-webapp-libs, copy-scratchpad-libs, compile-samples"
        description="Builds a local webapp directory usable as servlet context for quicker turn around">
      <copy todir="${build.war}/WEB-INF/classes">
        <fileset dir="${build.dest}"/>
        <fileset dir="${build.scratchpad.dest}"/>
      </copy>
    </target>
  
    <!-- =================================================================== -->
    <!-- Removes existing uncompressed webapp                                -->
    <!-- =================================================================== -->
    <target name="remove-webapp" if="remove.webapp" description="Removes existing uncompressed webapp" depends="init">
      <delete dir="${install.war}/${name}"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Installs Cocoon file                                                -->
    <!-- =================================================================== -->
    <target name="install" depends="package-core, webapp, remove-webapp" if="install.war" 
            description="Installs the WAR package">
      <copy file="${build.dir}/${name}.war" tofile="${install.war}/${name}.war"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Set a variable if the generated printer docs are already up-to-date. -->
    <!-- =================================================================== -->
    <target name="printer-docs_check" depends="init">
      <uptodate property="printer-docs.notrequired" targetfile="${build.docs.printer}/index.html" >
        <srcfiles dir="." includes="changes.xml,todo.xml"/>
        <srcfiles dir="${docs.dir}" includes="**/*.xml"/>
      </uptodate>
    </target>
  
    <!-- =================================================================== -->
    <!-- If generated printer docs is already up-to-date, print a message saying so. -->
    <!-- =================================================================== -->
    <target name="printer-docs_done" if="printer-docs.notrequired">
      <echo message="-------------------------------------------------------------"/>
      <echo message="Not rebuilding printer docs, as they are up-to-date:"/>
      <echo message="  ${build.docs.printer}/index.html is more recent than"/>
      <echo message="  todo.xml, changes.xml, ${docs.dir}/*.xml"/>
      <echo message="-------------------------------------------------------------"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Create the announcements                                            -->
    <!-- =================================================================== -->
    <target name="announcement" 
            depends="prepare-docs" 
            description="[admin] Creates the announcement for new releases">
  
      <copy file="announcement.xml" tofile="${build.context}\xdocs\announcement.xml" filtering="on"/>
  
      <xslt basedir="${build.context}\xdocs" 
             destdir="${build.dir}" 
             style="${build.context}\stylesheets\announcement2txt.xsl"
             includes="announcement.xml" 
             extension=".txt"
             force="true"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the printer-docs                                           -->
    <!-- =================================================================== -->
    <target name="prepare-printer-docs" depends="prepare-docs">
      <mkdir dir="${build.dir}/printer_documentation"/>
  
      <!-- copy prepared docs -->
      <copy todir="${build.dir}/printer_documentation" filtering="off">
        <fileset dir="${build.context}">
        </fileset>
      </copy>
  
      <!-- copy printer skin -->
      <copy todir="${build.dir}/printer_documentation/stylesheets" filtering="off" overwrite="yes">
        <fileset dir="${build.context}/stylesheets/printer_skin">
        </fileset>
      </copy>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Generate printer-friendly HTML docs                                 -->
    <!-- =================================================================== -->
    <target name="printer-docs" depends="package-core, prepare-printer-docs, printer-docs_check, printer-docs_done"
        unless="printer-docs.notrequired"
        description="Builds printer-friendly documentation">
      <mkdir dir="${build.docs.printer}"/>
  
      <java classname="org.apache.cocoon.Main" fork="true" dir="${build.dir}/printer_documentation" failonerror="true">
        <arg value="-c."/>
        <arg value="-d../printer-docs"/>
        <arg value="-w../work-printer"/>
        <arg value="-l../work-printer/cocoon.log"/>
        <arg value="-uINFO"/>
        <arg value="index.html"/>
        <classpath>
          <path refid="classpath"/>
          <fileset dir="${build.dir}">
            <include name="*.jar"/>
          </fileset>
          <pathelement location="${tools.jar}"/>
          <pathelement location="${build.context}/WEB-INF/classes"/>
        </classpath>
      </java>
    </target>
  
    <!-- =================================================================== -->
    <!-- Creates the web site                                                -->
    <!-- =================================================================== -->
    <target name="site" depends="docs, javadocs"
        description="[admin] Builds the web site">
      <mkdir dir="${site}"/>
      <copy todir="${site}" filtering="off">
        <fileset dir="${build.docs}">
        </fileset>
      </copy>
      <copy todir="${site}/apidocs" filtering="off">
        <fileset dir="${build.javadocs}"/>
      </copy>
    </target>
  
    <!-- =================================================================== -->
    <!-- Set a variable if javadoc is already up-to-date.                    -->
    <!-- =================================================================== -->
    <target name="javadocs_check">
      <mkdir dir="${build.javadocs}"/> 
      <uptodate property="javadocs.notrequired" targetfile="${build.javadocs}/packages.html" >
        <srcfiles dir= "${build.src}" includes="**/*.java,**/package.html"/>
      </uptodate>
    </target>
  
    <!-- =================================================================== -->
    <!-- If javadoc is already up-to-date, print a message saying so.        -->
    <!-- =================================================================== -->
    <target name="javadocs_done" if="javadocs.notrequired">
      <echo message="-------------------------------------------------------------"/>
      <echo message="Not rebuilding Javadocs, as they are up-to-date:"/>
      <echo message="  ${build.javadocs}/packages.html is more recent than"/>
      <echo message="  ${build.src}/**/*.java"/>
      <echo message="-------------------------------------------------------------"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Creates the API documentation                                       -->
    <!-- =================================================================== -->
    <target name="javadocs" depends="prepare-src-main, javadocs_check, javadocs_done"
           unless="javadocs.notrequired"
           description="Builds the API documentation (javadocs)">
  
      <!-- unfortunately we have to make a distinction between jdk 1.4 and before,
           because jdk 1.4 cannot cope very well with package names containing 'java'
           like in o.a.c.components.language.programming.java. -->
      <if>
        <equals arg1="1.4" arg2="${java.specification.version}"/>
        <then>
          <!-- Create the java docs for JDK 1.4 -->
          <javadoc packagenames="${packages}.*"
                   additionalparam="-subpackages ${packages} -breakiterator"
                   excludepackagenames="org.apache.cocoon.components.language.programming.java"
                   destdir="${build.javadocs}"
                   author="true"
                   version="true"
                   use="true"
                   noindex="false"
                   windowtitle="${Name} API (${version}, ${TODAY})"
                   doctitle="${Name}"
                   bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
                   stylesheetfile="${resource.dir}/javadoc.css"
                   useexternalfile="yes">
            <fileset dir="${build.dir}">
              <include name="src/**/*.java"/>
              <include name="blocks/**/*.java"/>
              <include name="deprecated/**/*.java"/>
            </fileset>
            <fileset dir="${blocks.dir}">
              <include name="**/mocks/**/*.java"/>
            </fileset>
            <classpath refid="classpath"/>
          </javadoc>
        </then>
        <else>
          <!-- Create the java docs for pre 1.4 -->
          <javadoc packagenames="${packages}.*"
                   destdir="${build.javadocs}"
                   author="true"
                   version="true"
                   use="true"
                   noindex="false"
                   windowtitle="${Name} API (${version}, ${TODAY})"
                   doctitle="${Name}"
                   bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
                   stylesheetfile="${resource.dir}/javadoc.css"
                   useexternalfile="yes">
            <!-- FIXME: Using this fileset technique fails with out-of-memory errors.
                 It seems that the cause is loading too many individual *.java files.
                 Try <sourcepath> instead and let javadoc load them.
            <fileset dir="${build.dir}">
              <include name="src/**/*.java"/>
              <include name="blocks/**/*.java"/>
              <include name="deprecated/**/*.java"/>
            </fileset>
            <fileset dir="${blocks.dir}">
              <include name="**/mocks/**/*.java"/>
            </fileset>
            -->
            <sourcepath location="${build.dir}/src"/>
            <sourcepath location="${build.dir}/blocks"/>
            <fileset dir="${blocks.dir}">
              <include name="**/mocks/**/*.java"/>
            </fileset>
            <classpath refid="classpath"/>
          </javadoc>
        </else>
      </if>
    </target>
  
    <!-- =================================================================== -->
    <!-- Generate the Emacs JDE project file                                 -->
    <!-- =================================================================== -->
    <target name="prj.el" depends="init, webapp-local"
            description="Generate the Emacs project file">
      <path id="jar.files">
        <fileset dir="${build.war}/WEB-INF/lib">
          <include name="*.jar"/>
        </fileset>
        <pathelement path="${build.context}/WEB-INF/classes"/>
      </path>
      <property name="jar.files" refid="jar.files"/>
      <copy file="${emacs.dir}/prj.el.in" tofile="prj.el" filtering="yes">
        <filterset>
          <filter token="jar.files" value="${jar.files}"/>
          <filter token="src.dir" value="${java.dir}"/>
          <filter token="build.war" value="${build.war}"/>
        </filterset>
      </copy>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the source distribution                                    -->
    <!-- =================================================================== -->
    <target name="dist-src" depends="docs, javadocs" 
            description="Prepares the source distribution">
      <!-- Simply copy all and add the html docs -->
      <mkdir dir="${dist.root}"/>
      <mkdir dir="${dist.src}"/>
      <mkdir dir="${dist.src}/bin"/>
      <mkdir dir="${dist.src}/lib"/>
      <mkdir dir="${dist.src}/src"/>
      <mkdir dir="${dist.src}/src/java"/>
      <mkdir dir="${dist.src}/src/documentation"/>
      <mkdir dir="${dist.src}/src/resources"/>
      <mkdir dir="${dist.src}/src/scratchpad"/>
      <mkdir dir="${dist.src}/src/webapp"/>
      <mkdir dir="${dist.src}/docs"/>
      <mkdir dir="${dist.src}/docs/apidocs"/>
      <mkdir dir="${dist.src}/tools"/>
  
      <copy todir="${dist.src}/tools">
        <fileset dir="${tools.dir}">
          <exclude name="anttasks/**"/> 
          <exclude name="lib/xalan*"/> 
          <exclude name="lib/xerces*"/> 
          <exclude name="lib/jtidy*"/> 
          <exclude name="lib/xml-apis.jar"/> 
        </fileset>
      </copy>
  
      <copy todir="${dist.src}/src/documentation">
        <fileset dir="${build.context}"/>
      </copy>
  
      <copy todir="${dist.src}/lib">
        <fileset dir="${lib.dir}"/>
      </copy>
  
      <copy todir="${dist.src}/src/resources" filtering="on">
        <fileset dir="${resource.dir}">
          <exclude name="**/*.gif"/>
          <exclude name="**/*.jpg"/>
          <exclude name="**/*.png"/>
       </fileset>
      </copy>
  
      <copy todir="${dist.src}/src/resources" filtering="off">
        <fileset dir="${resource.dir}">
          <include name="**/*.gif"/>
          <include name="**/*.jpg"/>
          <include name="**/*.png"/>
       </fileset>
      </copy>
  
      <copy todir="${dist.src}/src/java" filtering="off">
        <fileset dir="${java.dir}"/>
      </copy>
  
      <copy todir="${dist.src}/src/scratchpad" filtering="off">
        <fileset dir="${scratchpad.dir}"/>
      </copy>
      
      <copy todir="${dist.src}/src/webapp" filtering="on">
        <fileset dir="${webapp.dir}">
          <exclude name="**/*.gif"/>
          <exclude name="**/*.jpg"/>
          <exclude name="**/*.png"/>
       </fileset>
      </copy>
  
      <copy todir="${dist.src}/src/webapp" filtering="off">
        <fileset dir="${webapp.dir}">
          <include name="**/*.gif"/>
          <include name="**/*.jpg"/>
          <include name="**/*.png"/>
       </fileset>
      </copy>
  
      <!-- Fix for web.xml, cocoon.xconf and sitemap.xmap -->
      <copy file="${webapp.dir}/WEB-INF/cocoon.xconf" tofile="${dist.src}/src/webapp/WEB-INF/cocoon.xconf" filtering="off" overwrite="yes"/>
      <copy file="${webapp.dir}/sitemap.xmap" tofile="${dist.src}/src/webapp/sitemap.xmap" filtering="off" overwrite="yes"/>
      <copy file="${webapp.dir}/WEB-INF/web.xml" tofile="${dist.src}/src/webapp/WEB-INF/web.xml" filtering="off" overwrite="yes"/>
  
      <copy todir="${dist.src}/docs">
        <fileset dir="${build.docs}"/>
      </copy>
      <copy todir="${dist.src}/docs/apidocs">
        <fileset dir="${build.javadocs}"/>
      </copy>
  
      <copy todir="${dist.src}">
        <fileset dir="${docs.dir}">
          <include name="changes.xml, todo.xml"/>
        </fileset>
      </copy>
  
      <copy todir="${dist.src}" filtering="on">
       <fileset dir=".">
        <include name="README"/>
        <include name="CREDITS"/>
        <include name="legal/*"/>
        <include name="WARNING"/>
        <include name="*.bat"/>
        <include name="*.sh"/>
        <include name="KEYS"/>
        <include name="*.xml"/>
        <include name="*.properties"/>
       </fileset>
      </copy>
      <copy file="INSTALL-SRC.txt" tofile="${dist.src}/INSTALL" filtering="on"/>
  
      <chmod perm="+x" file="${dist.src}/run.sh"/>
      <chmod perm="+x" file="${dist.src}/build.sh"/>
      <chmod perm="+x" file="${dist.src}/tools/bin/antRun"/>
      <fixcrlf srcdir="${dist.src}" includes="**.sh"        eol="lf"/>
      <fixcrlf srcdir="${dist.src}" includes="antRun"       eol="lf"/>
      <fixcrlf srcdir="${dist.src}" includes="**.bat"      eol="crlf"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Packages the source distribution as .zip                            -->
    <!-- =================================================================== -->
    <target name="dist-src-zip" depends="dist-src">
      <zip zipfile="${dist.target}/${dist.name}-src.zip"
           basedir="${dist.root}/source"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Packages the source distribution with .tar.gzip                     -->
    <!-- =================================================================== -->
    <target name="dist-src-tgz" depends="dist-src">
      <tar tarfile="${dist.target}/${dist.name}-src.tar"
           basedir="${dist.root}/source"
           longfile="gnu"/>
      <gzip zipfile="${dist.target}/${dist.name}-src.tar.gz"
            src="${dist.target}/${dist.name}-src.tar"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the binary distribution                                    -->
    <!-- =================================================================== -->
    <target name="dist-bin" depends="package-core, webapp, docs, javadocs">
      <!-- Copy webapp and the html docs -->
      <mkdir dir="${dist.root}"/>
      <mkdir dir="${dist.bin}"/>
      <mkdir dir="${dist.bin}/webapp"/>
      <mkdir dir="${dist.bin}/docs"/>
      <mkdir dir="${dist.bin}/docs/apidocs"/>
  
      <copy todir="${dist.bin}/webapp">
          <fileset dir="${build.war}"/>
      </copy>
  
      <!-- And now the jars -->
      <copy todir="${dist.bin}/webapp/WEB-INF/lib">
        <fileset dir="${lib.dir}/endorsed">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
      </copy>    
      <copy todir="${dist.bin}/webapp/WEB-INF/lib">
        <fileset dir="${lib.dir}/core">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
        <fileset dir="${lib.dir}/core/jvm${target.vm}">
          <include name="*.jar"/>
        </fileset>
      </copy>
      <copy todir="${dist.bin}/webapp/WEB-INF/lib">
        <fileset dir="${lib.dir}/optional">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
      </copy>
      <copy todir="${dist.bin}/webapp/WEB-INF/lib">
        <fileset dir="${lib.dir}/local">
          <include name="*.jar"/>
          <exclude name="servlet*.jar"/>
        </fileset>
      </copy>
  
      <copy todir="${dist.bin}/webapp/WEB-INF/lib">
        <fileset dir="${build.dir}">
            <include name="*-block.jar"/>
        </fileset>
        <mapper type="glob" from="*-block.jar" to="cocoon-*-block-${version}.jar"/>
      </copy>    
  
      <copy file="${build.dir}/${name}.jar"
            tofile="${dist.bin}/webapp/WEB-INF/lib/${name}-${version}.jar"/>
      <copy file="${build.dir}/${name}-samples.jar"
            todir="${dist.bin}/webapp/WEB-INF/lib/"/>
  
      <copy todir="${dist.bin}/docs">
        <fileset dir="${build.docs}"/>
      </copy>
      <copy todir="${dist.bin}/docs/apidocs">
        <fileset dir="${build.javadocs}"/>
      </copy>
  
      <copy todir="${dist.bin}">
        <fileset dir="${docs.dir}">
          <include name="changes.xml, todo.xml"/>
        </fileset>
      </copy>
  
      <copy todir="${dist.bin}" filtering="on">
       <fileset dir=".">
        <include name="CREDITS"/>
        <include name="README"/>
        <include name="legal/*"/>
        <include name="WARNING"/>
        <include name="KEYS"/>
       </fileset>
      </copy>
      <copy file="INSTALL-BIN.txt" tofile="${dist.bin}/INSTALL" filtering="on"/>
  
      <!-- Build the war file -->
      <jar jarfile="${dist.bin}/${name}.war" 
           basedir="${dist.bin}/webapp" 
           includes="**" 
           excludes="samples/**"
           manifest="${build.war}/WEB-INF/Manifest.mf"/>
  
      <!-- Delete the webapp directory -->
      <delete dir="${dist.bin}/webapp"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Packages the binary distribution as .zip                            -->
    <!-- =================================================================== -->
    <target name="dist-bin-zip" depends="dist-bin">
      <zip zipfile="${dist.target}/${dist.name}-bin.zip"
           basedir="${dist.root}/bin"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Packages the binary distribution with .tar.gzip                     -->
    <!-- =================================================================== -->
    <target name="dist-bin-tgz" depends="dist-bin">
      <tar tarfile="${dist.target}/${dist.name}-bin.tar"
           basedir="${dist.root}/bin"
           longfile="gnu"/>
      <gzip zipfile="${dist.target}/${dist.name}-bin.tar.gz"
            src="${dist.target}/${dist.name}-bin.tar"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepares the binary distribution                                    -->
    <!-- =================================================================== -->
    <target name="dist-samples" depends="webapp">
      <!-- Copy webapp and the html docs -->
      <mkdir dir="${dist.samples}/samples"/>
      <copy todir="${dist.samples}/samples">
          <fileset dir="${build.war}/samples"/>
      </copy>
    </target>
  
    <!-- =================================================================== -->
    <!-- Packages the samples distribution as .zip                            -->
    <!-- =================================================================== -->
    <target name="dist-samples-zip" depends="dist-samples">
      <zip zipfile="${dist.target}/${dist.name}-samples.zip"
           basedir="${dist.samples}"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Packages the samples distribution with .tar.gzip                     -->
    <!-- =================================================================== -->
    <target name="dist-samples-tgz" depends="dist-samples">
      <tar tarfile="${dist.target}/${dist.name}-samples.tar"
           basedir="${dist.samples}"
           longfile="gnu"/>
      <gzip zipfile="${dist.target}/${dist.name}-samples.tar.gz"
            src="${dist.target}/${dist.name}-samples.tar"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Build all distributions                                             -->
    <!-- =================================================================== -->
    <target name="dist-info" depends="init">
      <echo>**********************************************</echo>
      <echo>*</echo>
      <echo>*  Build all distributions:</echo> 
      <echo>*  - source distribution for windows/unix.</echo>
      <echo>*  - binary distribution for windows/unix.</echo>
      <echo>*</echo>        
      <echo>*  This may take a while...</echo>        
      <echo>*</echo>        
      <echo>***********************************************</echo>
      <echo/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Build all distributions                                             -->
    <!-- =================================================================== -->
    <target name="dist"
            depends="dist-info, dist-bin-tgz, dist-bin-zip, dist-src-tgz, dist-src-zip, dist-samples-tgz, dist-samples-zip"
            description="[admin] Builds the distributions">
    </target>
  
    <!-- =================================================================== -->
    <!-- Clean targets                                                       -->
    <!-- =================================================================== -->
    <target name="clean" depends="init" description="Cleans the build directories">
      <delete dir="${build.dir}"/>
      <delete dir="${tools.dir}/anttasks"/>
    </target>
  
    <target name="distclean" depends="clean" description="Cleans everything to the original state">
      <delete dir="${build.root}"/>
      <delete file="${dist.target}/${Name}-${version}.tar.gz"/>
      <delete file="${dist.target}/${Name}-${version}.tar"/>
      <delete file="${dist.target}/${Name}-${version}.zip"/>
      <delete file="${dist.target}/${Name}-${version}-src.tar.gz"/>
      <delete file="${dist.target}/${Name}-${version}-src.tar"/>
      <delete file="${dist.target}/${Name}-${version}-src.zip"/>
      <delete file="${dist.target}/${Name}-${version}-bin.tar.gz"/>
      <delete file="${dist.target}/${Name}-${version}-bin.tar"/>
      <delete file="${dist.target}/${Name}-${version}-bin.zip"/>
      <delete file="${dist.target}/${Name}-${version}-samples.tar.gz"/>
      <delete file="${dist.target}/${Name}-${version}-samples.tar"/>
      <delete file="${dist.target}/${Name}-${version}-samples.zip"/>
      <delete dir="${dist.root}"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Test targets                                                       -->
    <!-- =================================================================== -->
    <target name="test" depends="junit.tests, anteater.tests"
            description="Runs all the tests"/>
  
    <!-- =================================================================== -->
    <!-- Junit Test targets                                                  -->
    <!-- =================================================================== -->
    <target name="junit.tests" depends="compile" description="[admin] Perform jUnit tests">
      <mkdir dir="${build.test}"/>
      <!-- Copy test files to build test dir -->
      <copy todir="${build.test}" filtering="on">
        <fileset dir="${test.dir}"/>
      </copy>
      <!-- Compile tests -->
      <javac srcdir="${build.test}"
              destdir="${build.test}"
              debug="${debug}"
              optimize="${optimize}"
              deprecation="${deprecation}"
              target="${target.vm}"
              fork="true">
        <classpath refid="classpath"/>
        <classpath refid="scratchpad.classpath"/>
        <classpath>
          <pathelement path="${build.dest}" />
          <pathelement path="${build.scratchpad.dest}" />
        </classpath>
      </javac>
      <junit printsummary="yes" haltonfailure="yes" fork="yes">
        <classpath>
          <pathelement location="${build.test}" />
          <pathelement location="${build.dest}" />
          <pathelement location="${build.scratchpad.dest}" />
          <pathelement path="${java.class.path}" />
        </classpath>
        <classpath refid="classpath"/>
        <classpath refid="scratchpad.classpath"/>
        <formatter type="plain" usefile="no" />
        <batchtest>
          <fileset dir="${build.test}">
            <include name="**/*TestCase.class"/>
            <include name="**/*Test.class" />
            <exclude name="**/AllTest.class" />
            <exclude name="**/*$$*Test.class" />
            <exclude name="**/Abstract*.class" />
          </fileset>
        </batchtest>
      </junit>
    </target>
  
    <!-- =================================================================== -->
    <!-- Anteater tests                                                      -->
    <!-- =================================================================== -->
    <target name="anteater.tests"
            description="Runs the Anteater functional tests">
      <property name="host" value="localhost"/>
      <property name="port" value="8080"/>
      <property name="base" value="cocoon"/>
  
      <exec executable="anteater">
        <arg line="-f src/test/anteater/all-tests.xml -Dhost=${host} -Dport=${port} -Dbase=${base}"/>
      </exec>
    </target>
  
    <!-- =================================================================== -->
    <!-- Fix line endings in src                                             -->
    <!-- =================================================================== -->
    <target name="fixsrclf" depends="init" description="Fix lf in src directory (internal use only!)">
      <fixcrlf srcdir="${java.dir}" includes="**/*.java" eol="lf"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Check if all the JAR files are properly declared in lib/jars.xml    -->
    <!-- =================================================================== -->
    <target name="check-jars" depends="init">
      <path id="all.jars">
        <fileset dir="${lib.dir}">
          <include name="**/*.jar"/>
        </fileset>
      </path>
  
      <property name="all.jars" refid="all.jars"/>
      <copy file="${lib.dir}/jars.xml.tmpl"
            tofile="${build.dir}/current-jars.xml"
            filtering="yes"
            overwrite="yes">
        <filterset>
          <filter token="JARS" value="${all.jars}"/>
        </filterset>
      </copy>
      
      <!-- split the path in 'jar' XML elements -->
      <replace file="${build.dir}/current-jars.xml"
               token="${path.separator}" value="&lt;/jar&gt;&#xA; &lt;jar&gt;"/>
      <!-- relativize file names by removing the current directory -->
      <replace file="${build.dir}/current-jars.xml"
               token="${user.dir}${file.separator}lib${file.separator}" value=""/>
      <!-- and incase that fails, remove the base directory -->
      <replace file="${build.dir}/current-jars.xml"
               token="${basedir}${file.separator}lib${file.separator}" value=""/>
  
      <!-- replace platform-dependent path separator by '/' -->
      <replace file="${build.dir}/current-jars.xml"
               token="${file.separator}" value="/"/>
  
      <xslt in="${lib.dir}/jars.xml" out="${build.dir}/jars.xml"
             processor="trax"
             style="${tools.dir}/src/check-jars.xsl">
        <param name="current-files"
               expression="../../${build.dir}/current-jars.xml"/>
      </xslt>
    </target>
    
    
    <!-- =================================================================== -->
    <!-- Validation of core important configuration files using RELAX NG     -->
    <!-- =================================================================== -->
    <!-- Depends on "prepare-webapp" target, so that the sitemaps are generated
         and copied to the build.
         Uses the Jing anttask.
     -->
    <target name="validate-config"
            description="Validation of core configuration files using RELAX NG"
            depends="prepare-webapp"
            if="validate.config">
      <echo message="Conducting validation of core configuration files."/>
      <echo message="(You can turn validation off if you must, using ./properties.xml)"/>
  
      <!-- cocoon.roles -->
      <echo message="Validating all cocoon.roles instances ..."/>
      <jing rngfile="${webapp.dir}/WEB-INF/entities/roles-v01.rng">
        <fileset dir="${build.dir}" includes="**/cocoon.roles"/>
      </jing>
  
      <!-- All stylesheets **/*.xsl -->
      <echo message="Validating all stylesheets ..."/>
      <jing rngfile="${webapp.dir}/WEB-INF/entities/xslt-20020523.rng">
        <!-- FIXME: Need catalog entity resolver, so excluding catalog tester xsl -->
        <!-- FIXME: Excluding the "hello world" SWF sitemap (minor issue) -->
        <fileset dir="${src.dir}" includes="**/*.xsl"
                 excludes="**/catalog/style.xsl, **/simple-page2swf.xsl"/>
        <fileset dir="${tools.dir}" includes="**/*.xsl"/>
      </jing>
  
      <!-- The Treeprocessor builtins -->
      <echo message="Validating the treeprocessor builtins ..."/>
      <xmlvalidate failonerror="true" lenient="no" warn="yes">
        <fileset dir="${java.dir}" includes="**/treeprocessor-builtins.xml"/>
      </xmlvalidate>
  
      <!-- sitemap.xmap -->
      <!-- leaving this until last because it is the one most likely to break -->
      <echo message="Validating all sitemap.xmap instances ..."/>
      <!-- FIXME: The sitemaps and their RNG grammar still need tweaking -->
      <jing rngfile="${webapp.dir}/WEB-INF/entities/sitemap-v06.rng">
        <fileset dir="${build.dir}" includes="**/sitemap.xmap"/>
      </jing>
    </target>
  
    <!-- =================================================================== -->
    <!-- Validation of xdocs                                                 -->
    <!-- =================================================================== -->
    <!-- This only does documentation/xdocs/**.xml and does not attempt to do
         webapps, blocks, java, etc. because most of their xdocs do not bother
         to declare a ruleset. -->
    <target name="validate-xdocs"
            description="Validation of all core XML documentation"
            depends="prepare-docs"
            if="validate.xdocs">
      <echo message="Conducting validation of core XML documentation."/>
      <echo message="(You can turn validation off if you must, using ./properties.xml)"/>
  
      <echo message="Validating all **/book.xml instances using RELAX NG ..."/>
      <jing rngfile="${webapp.dir}/WEB-INF/entities/book-v01.rng">
        <fileset dir="${build.context}" includes="**/book.xml"/>
      </jing>
  
      <echo message="Validating all xdocs/**/*.xml instances using DTDs ..."/>
      <xmlvalidate failonerror="true" lenient="no" warn="yes">
        <!-- FIXME: we can use xmlcatalog with Ant-1.6 -->
        <fileset dir="${build.context}/xdocs" includes="**/*.xml"
                 excludes="drafts/*.xml,dictionary.xml,catalog-test.xml,ctwig/sample/**/*.xml"/>
      </xmlvalidate>
  
      <echo message="Validating the documentation sitemap.xmap using RELAX NG ..."/>
      <jing rngfile="${webapp.dir}/WEB-INF/entities/sitemap-v06.rng">
        <fileset dir="${build.context}" includes="sitemap.xmap"/>
      </jing>
  
      <echo message="Validating all documentation stylesheets using RELAX NG ..."/>
      <jing rngfile="${webapp.dir}/WEB-INF/entities/xslt-20020523.rng">
        <fileset dir="${build.context}/stylesheets" includes="**/*.xsl"/>
      </jing>
    </target>
  
    <!-- =================================================================== -->
    <!-- Generate Schematron validators from RNG grammars.                   -->
    <!-- Evidently this will not work with Xalan due to a bug.               -->
    <!-- Needs XSLTC or Saxon7 (but the classpath attribute won't work).     -->
    <!--                                                                     -->
    <!-- These are two temporary targets undergoing testing.                 -->
    <!--===================================================================  -->
    <!-- Depends on some "prepare-*" targets, so that the sitemaps are generated
         and copied to the build.
    -->
    <target name="prepare-schematron"
            description="Generate Schematron schema from RNG grammar"
            depends="prepare-webapp, prepare-webapp-scratchpad"
            if="validate.config">
      <echo message="Generating Schematron schemas from RELAX NG grammars"/>
      <echo message="Currently doing: sitemap.rng only"/>
      <xslt in="${webapp.dir}/WEB-INF/entities/sitemap-v06.rng"
            out="${tools.dir}/src/schematron/sitemap.sch"
            style="${tools.dir}/src/schematron/RNG2Schtrn.xsl"/>
      <echo message="Generating XSLT validators from Schematron schemas"/>
      <xslt in="${tools.dir}/src/schematron/sitemap.sch"
            out="${tools.dir}/src/schematron/validate-sitemap.xsl"
            style="${tools.dir}/src/schematron/schematron-basic.xsl"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Validate with Schematron                                            -->
    <!--===================================================================  -->
    <target name="validate-schematron"
            description="Validate against Schematron schemas generated from RNG grammars"
            depends="prepare-schematron">
      <echo message="NOTE: this is an experimental build target."/>
      <echo message="Removing any old reports ..."/>
      <delete quiet="yes">
        <fileset dir="${build.dir}" includes="**/sitemap.report" />
      </delete>
      <echo message="Running schematron validators"/>
      <echo message="Currently doing: **/sitemap.xmap only"/>
      <xslt basedir="${build.dir}" includes="**/sitemap.xmap"
            destdir="${build.dir}" extension=".report"
            style="${tools.dir}/src/schematron/validate-sitemap.xsl"/>
      <echo message="Removing any empty reports ..."/>
      <delete quiet="yes">
        <fileset dir="${build.dir}" includes="**/sitemap.report" >
          <size value="0"/>
        </fileset>
      </delete>
      <echo message="Listing any new error reports ..."/>
      <apply executable="ls" failonerror="false" skipemptyfilesets="true">
        <fileset dir="${build.dir}" includes="**/sitemap.report" />
        <arg value="-l"/>
      </apply>
      <apply executable="false" failonerror="true" skipemptyfilesets="true">
        <fileset dir="${build.dir}" includes="**/sitemap.report" />
      </apply>
    </target>
  
    <!-- =================================================================== -->
    <!-- Build the Eclipse projects files                                    -->
    <!--===================================================================  -->
    <target name="eclipse-project" depends="init">
    
      <!-- prepare the various paths that will form the project -->
      <path id="src.dirs">
        <!-- main source dir -->
        <pathelement path="${src.dir}/java"/>
        <!-- deprecated source dir -->
        <pathelement path="${src.dir}/deprecated/java"/>
        <!-- scratchpad source dir -->
        <pathelement path="${src.dir}/scratchpad/src"/>
        <!-- blocks source dirs -->
        <dirset dir="${blocks.dir}">
          <include name="*/java"/>
        </dirset>
      </path>
      
      <path id="mocks.dirs">
        <!-- main mocks dir -->
        <pathelement path="${mocks.dir}"/>
        <!-- scratchpad mocks dir -->
        <pathelement path="${src.dir}/scratchpad/mocks"/>
        <!-- blocks mocks dirs -->
        <dirset dir="${blocks.dir}">
          <include name="*/mocks"/>
        </dirset>
      </path>
      
      <path id="libs">
        <!-- main libs -->
        <fileset dir="${lib.dir}">
          <include name="core/*.jar"/>
          <include name="core/jvm${target.vm}/*.jar"/>
          <include name="optional/*.jar"/>
          <include name="local/*.jar"/>
          <include name="endorsed/*.jar"/>
        </fileset>
        <!-- scratchpad libs -->
        <fileset dir="${scratchpad.dir}/lib">
          <include name="*.jar"/>
        </fileset>
        <!-- tools libs -->
        <fileset dir="${tools.dir}/lib">
          <include name="*.jar"/>
          <!-- exclude xerces, xalan, xmlapis -->
          <exclude name="x*.jar"/>
        </fileset>
        <!-- no block-specific libs for now -->
      </path>
      
      <!-- convert paths to properties -->
      <property name="src.dirs" refid="src.dirs"/>
      <property name="mocks.dirs" refid="mocks.dirs"/>
      <property name="libs" refid="libs"/>
      
      <!-- expand properties in the template file -->
      <copy file="${src.dir}/resources/dev/eclipse/classpath-tmpl.xml"
            tofile="${build.work}/classpath-temp.xml"
            filtering="yes"
            overwrite="yes">
        <filterset>
          <filter token="SRC_DIRS" value="${src.dirs}"/>
          <filter token="LIBS" value="${libs}"/>
          <filter token="MOCKS_DIRS" value="${mocks.dirs}"/>
        </filterset>
      </copy>
      
      <!-- split the path in 'item' XML elements -->
      <replace file="${build.work}/classpath-temp.xml"
               token="${path.separator}" value="&lt;/item&gt;&#xA; &lt;item&gt;"/>
      <!-- relativize file names by removing the current directory -->
      <replace file="${build.work}/classpath-temp.xml"
               token="${user.dir}${file.separator}" value=""/>
      <!-- and in case that fails, remove the base directory -->
      <replace file="${build.work}/classpath-temp.xml"
               token="${basedir}${file.separator}" value=""/>
  
      <!-- replace platform-dependent path separator by '/' -->
      <replace file="${build.work}/classpath-temp.xml"
               token="${file.separator}" value="/"/>
  
      <!-- now build the .classpath file -->
      <xslt in="${build.work}/classpath-temp.xml" out="${basedir}/.classpath"
            processor="trax"
            style="${src.dir}/resources/dev/eclipse/make-classpath.xsl"/>
      
      <!-- copy the project file (expand version) -->
      <copy file="${src.dir}/resources/dev/eclipse/project"
            tofile="${basedir}/.project"
            overwrite="yes">
        <filterset>
          <filter token="VERSION" value="${version}"/>
        </filterset>
      </copy>
    </target>
  
      
    <!-- ***************************************************************** -->
    <!-- ***************************************************************** -->
    <!-- **                                                             ** -->
    <!-- **              LOCAL SERVER RUN ACTION                        ** -->
    <!-- **                                                             ** -->
    <!-- ***************************************************************** -->
    <!-- ***************************************************************** -->
  
    <target name="run" 
            description="Run Jetty with configuration set by the jetty.run property"
            depends="init">
      
      <antcall target="webapp-local"/>
  
      <copy file="${tools.dir}/jetty/conf/jettyconf.xml"
            todir="${build.war}" filtering="on"/>
     
      <java classname="org.mortbay.jetty.Server"
            dir="${build.war}"
            fork="yes"
            failonerror="yes">
         <classpath>
           <path refid="classpath" />
           <fileset dir="${tools.dir}/jetty/lib">
             <include name="*.jar"/>
             <include name="*.JAR"/>
             <include name="*.zip"/>
             <include name="*.ZIP"/>
           </fileset>         
         </classpath>
        
         <jvmarg value="-Djava.endorsed.dirs=${java.endorsed.dirs}${path.separator}${endorsed.dir}"/>
         <sysproperty key="jetty.home" value="${antfile.dir}/build/cocoon/webapp/"/>
         <sysproperty key="org.xml.sax.parser" value="org.apache.xerces.parsers.SAXParser"/>
         <arg line="jettyconf.xml" />
      </java>
    </target>  
  </project>
  
  <!-- End of file -->
  
  
  
  1.1                  xml-cocoon2/build.properties
  
  Index: build.properties
  ===================================================================
  version=2.1-dev
  released.version=2.0.4
  year=1999-2003
  
  name=cocoon
  Name=Cocoon
  fullname=Apache ${Name}
  
  packages=org.apache
  
  validate.config=true
  validate.xdocs=true
  
  #exclude.webapp.documentation=true
  #exclude.webapp.javadocs=true
  #exclude.webapp.scratchpad=true
  #exclude.webapp.samples=true
  #exclude.webapp.libs=true
  #exclude.scratchpad=true
  #exclude.deprecated=true
  
  src=src
  java=${src}/java
  mocks=${src}/mocks
  test=${src}/test
  resources=${src}/resources
  resources.styles=${resources}/styles
  resources.logos=${resources}/logos
  context=${src}/documentation
  docs=${context}/xdocs
  images=${context}/images
  blocks=${src}/blocks
  samples=${src}/samples
  
  scratchpad=${src}/scratchpad
  scratchpad.src=${scratchpad}/src
  scratchpad.lib=${scratchpad}/lib
  scratchpad.webapp=${scratchpad}/webapp
  
  deprecated=${src}/deprecated
  deprecated.src=${deprecated}/java
  
  webapp=${src}/webapp
  
  webapp.samples.database.driver=org.hsqldb.jdbcDriver
  webapp.samples.database.url=jdbc:hsqldb:hsql://localhost:9002
  webapp.samples.database.user=sa
  webapp.samples.database.password=
  
  dist.root=dist
  dist=${dist.root}/${name}
  dist.src=${dist}/source
  dist.bin=${dist}/bin
  dist.samples=${dist}/samples
  
  site=../xml-site/targets/cocoon
  
  tools=tools
  tools.lib=${tools}/lib
  tools.src=${tools}/src
  tools.tasks=${tools}/anttasks
  tools.jetty=${tools}/jetty
  tools.jetty.port=8888
  
  lib=lib
  lib.core=${lib}/core
  lib.endorsed=${lib}/endorsed
  lib.optional=${lib}/optional
  lib.local=${lib}/local
  
  compiler=modern
  compiler.debug=on
  compiler.optimize=on
  compiler.deprecation=off
  compiler.nowarn=on
  compiler.emacs=on
  compiler.warnings=on
  compiler.pedantic=off
  compiler.depend=on
  compiler.fulldepend=on
  
  build.root=build
  build=${build.root}/${name}-${version}
  build.src=${build}/src
  build.dest=${build}/classes
  build.mocks=${build}/mocks
  build.test=${build}/test
  build.docs=${build}/docs
  build.docs.loglevel=ERROR
  build.docs.printer=${build}/printer-docs
  build.docs.printer.loglevel=ERROR
  build.xdocs=${build}/xdocs
  build.javadocs=${build}/javadocs
  build.context=${build}/documentation
  build.context.printer=${build}/printer-documentation
  build.temp=${build}/temp
  build.samples=${build}/samples
  build.blocks=${build}/blocks
  
  build.webapp=${build}/webapp
  build.webapp.lib=${build}/webapp/WEB-INF/lib
  
  build.war=${build}/${name}.war
  
  #build.xsp.precompile=true
  
  build.scratchpad=${build}/scratchpad
  build.scratchpad.src=${build.scratchpad}/src
  build.scratchpad.dest=${build.scratchpad}/classes
  
  build.deprecated=${build}/deprecated
  build.deprecated.src=${build.deprecated}/src
  build.deprecated.dest=${build.deprecated}/classes
  
  
  
  1.1                  xml-cocoon2/BUILD.txt
  
  Index: BUILD.txt
  ===================================================================
  
                         * =========================== *
                         |  Apache Cocoon Build System |
                         * =========================== *
  
  
  Before you begin
  ================
  
  To make things easier for you, the Cocoon distribution contains a precompiled
  version of Ant and the build scripts take care of running it.
  
  The only thing that you have to make sure, is the "JAVA_HOME" environment
  property should be set to match the JVM you want to use.
  
  That's all you have to do to be ready to go.
  
  
  Building instructions
  =====================
  
  Ok, let's build the baby. First, make sure your current working directory is
  where this very file is located. Then type
  
    [unix] ./build.sh
    [win32] .\build.bat
  
  if everything is right and all the required packages are visible, this action
  will generate a file called "cocoon.jar" in the "./build/cocoon" directory.
  Note, that if you do further development, compilation time is reduced since
  Ant is able of detecting which files have changed and to recompile them at need.
  
  Also, you'll note that reusing a single JVM instance for each task, increases
  tremendously the performance of the whole build system, compared to other
  tools (i.e. make or shell scripts) where a new JVM is started for each task.
  
  
  
  Build targets
  =============
  
  The build system is not only responsible of compiling Cocoon into a jar file,
  but is also responsible for creating the HTML documentation, javadocs,
  distributions and web site. In fact, the file you have here is _exactly_ what
  is used by cocoon maintainers to take care of everything in the Cocoon
  project, no less and no more.
  
  To know more about the available targets type
  
   [unix]  ./build.sh  -projecthelp
   [win32] .\build.bat -projecthelp
  
  
  
  Tuning the build for your local needs
  =====================================
  
  The Cocoon Build system has been designed with tunability in mind. This means
  that you don't have to modify the files that come with cocoon (even right
  out of CVS) but you can add your own local property files that will override
  the defaults that Cocoon ships with.
  
  To do this, simply create a file called
  
    local.build.properties
  
  in the cocoon root directory (where you found this file you're reading now)
  and copy the properties from the 'build.property' file that you wish to 
  modify.
  
  But if your build environment is shared by many different users, you can 
  override even those local properties by placing a file called
  
   cocoon.build.properties
   
  in your /home/ directory (under UNIX, on win32 your mileage may vary since 
  your home directory depends on what JVM you are using).
  
  So, to summarize, each build property will be read from
  
   - ${user.home}/cocoon.build.properties
   - ${cocoon.home}/local.build.properties
   - ${cocoon.home}/build.properties
   
  in this order.
  
  
                                Happy hacking from the Apache Cocoon Dev Team :)
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org