Java/Ant/Compile — различия между версиями

Материал из Java эксперт
Перейти к: навигация, поиск
 
м (1 версия)
 
(нет различий)

Текущая версия на 06:37, 1 июня 2010

Ant compile from src folder to build folder, set the class path and java files include

 
<project name="YourName" default="all">
  <target name="all" depends="init,clean,compile,createJars,copyBuild" >
  </target>
  <target name="init" description="Project">
    <property environment="env" />
    <property name="j2sdkApi" value="${env.JAVA_HOME}/jre/lib/rt.jar" />
      <property name="src" value="./src" />
    <property name="build" value= "./build" />
  </target>
  <target name="clean" description="build" depends="init">
    <delete dir="${build}" />
    <mkdir dir="${build}" />
  </target>
  <target name="compile" description="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}" >
      <classpath path="${j2sdkApi}" />
            <include name="**/application/**"/>
      <include name="**/types/**"/>
    </javac>
  </target>
  <target name="copyBuild" description="desccription here">
    <copy file="${src}/LOGOUNB_CAPA.JPG" todir="${build}/" />
    <copydir src="${src}/config" dest="${build}/config" />
  </target>
  <target name="createJars" description="jars" depends="compile">
    <mkdir dir="${build}/xml/jar"/>
    <jar jarfile="${build}/br/xml/jar/xpfg.jar"
       basedir="${build}/unb/cic/xml" />
      <manifest file="manifest.mf">
        <attribute name="Main-Class" value="${build}/br/unb/cic/xml/XMLMain" />
      </manifest>
  </target>
</project>





Ant javac includes

 
<?xml version="1.0"?>
<project name="yourname" basedir=".." default="all">
  <property name="dist" location="dist/"/> 
  <property name="lib" location="lib/"/> 
  <property name="src" location="src/"/> 
  <path id="class.path">
    <pathelement path="${src}"/> 
    <fileset dir="${lib}">
      <include name="**/*.jar"/>
      <include name="**/*.zip"/>
    </fileset> 
    <fileset dir="/dev">
      <include name="**/*.jar"/>
      <include name="**/*.zip"/>
    </fileset> 
  </path>
  
  
  <target name="clean">
    <delete>
      <fileset dir="${src}" includes="**/*.class"/>
    </delete>
    <delete dir="${dist}"/>
  </target>
  
  <target name="zip" depends="clean">
    <tstamp/>
    <mkdir dir="${dist}"/>
    <zip destfile="${dist}\actionServlet-${DSTAMP}${TSTAMP}.zip">
      <zipfileset dir=".">
        <exclude name="${dist}"/>
      </zipfileset>
    </zip>
  </target>
  <target name="compile">
    <javac>
      <src path="${src}" />
      <classpath refid="class.path"/> 
      <include name = "*/**" />
    </javac>
   </target>
  <target name="jar" depends="compile">
    <mkdir dir="${dist}"/>
    <tstamp/>
    <jar
      basedir="src"
      jarfile="${dist}/actionServlet.jar"
      excludes="**/*.java, *.mdb"
    />
  </target>
  <target name="all" depends="jar"/>
</project>





Ant Javac setting

 
<?xml version="1.0"?>
<!--
            The BSD License for the JGoodies Animation
            
Copyright (c) 2001-2009 JGoodies Karsten Lentzsch. All rights reserved.
Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
 o Redistributions of source code must retain the above copyright notice, 
   this list of conditions and the following disclaimer. 
    
 o Redistributions in binary form must reproduce the above copyright notice, 
   this list of conditions and the following disclaimer in the documentation 
   and/or other materials provided with the distribution. 
    
 o Neither the name of JGoodies Karsten Lentzsch nor the names of 
   its contributors may be used to endorse or promote products derived 
   from this software without specific prior written permission. 
    
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

   $Id: build.xml,v 1.11 2006/06/16 18:33:59 karsten Exp $
   This is a build file for use with the Jakarta Ant build tool, see
   http://jakarta.apache.org/ant/index.html
   To build, go to the directory where this file is located and run
     ant <target>
   with one of the following targets:
   
     clean               removes temporary files and directories
     compile             compiles the core, extras, tutorial and tests
     javadoc             creates the API documentation
     test                compiles and runs the unit tests
     jar                 creates a library jar
     create-dist-dir     creates a distribution tree: docs, sources, jar
     create-dist-zip     creates a zipped distribution
     create-maven-bundle creates a Maven bundle
     create-all          creates the distribution zip and Maven bundle
     
   To run the unit tests you MUST set the junit.jar property,
   for example in your user build.properties file. 
-->
<project default="create-all" basedir="." name="JGoodies Animation" >
    <!-- ***************************************************************** -->
    <!-- Give users a chance to override build properties.                 -->
    <!-- ***************************************************************** -->
    <property file="${user.home}/animation.build.properties" />
    <property file="${user.home}/build.properties" />
    <property file="${basedir}/build.properties" />
    <property file="${basedir}/default.properties" />
 
 
    <!-- ***************************************************************** -->
    <!-- P A T H S                                                         -->
    <!-- ***************************************************************** -->
    <path id="classpath.core">
        <pathelement location="${build.core.dir}"   /> 
    </path>
    
    <path id="classpath.tests">
        <pathelement location="${build.core.dir}"   /> 
        <pathelement location="${build.test.dir}"   /> 
        <pathelement location="${junit.jar}"     /> 
    </path>
  
    <path id="classpath.tutorial">
        <pathelement location="${lib.binding.jar}"  /> 
        <pathelement location="${lib.forms.jar}"    /> 
        <pathelement location="${build.core.dir}"   /> 
    </path>
    
  
    <!-- ***************************************************************** -->
    <!-- C L E A N                                                         -->
    <!-- ***************************************************************** -->
  <target name="clean"  
        description="Removes all temporary files and directories." >
    <delete dir="${build.dir}" />
    <delete dir="${dist.dir}"  />
  </target>
  
    <!-- ***************************************************************** -->
    <!-- P R E P A R A T I O N                                             -->
    <!-- ***************************************************************** -->
  <target name="prepare" 
          description="Prepares the build and distribution targets." >
        <tstamp>
           <format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" />
        </tstamp>
        
    <mkdir dir="${build.core.dir}"      />
    <mkdir dir="${build.tutorial.dir}"  />
        <available
            property="junit.task.present"
            classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
        />
        <available
            property="junit.jar.present"
            file="${junit.jar}"
        />
  </target>
  
  
    <!-- ***************************************************************** -->
    <!-- C O M P I L A T I O N                                             -->
    <!-- ***************************************************************** -->
  <target name="compile" 
          depends="compile-core, compile-tests, compile-tutorial" 
          description="Compiles the library core, test, and tutorial." />
          
    <!-- ***************************************************************** -->
  <target name="compile-core" depends="prepare"
          description="Compiles the core sources." >
    <javac 
      srcdir       ="${src.core.dir}" 
      destdir      ="${build.core.dir}"
          encoding     ="${build.encoding}"
          executable   ="${build.rupile.executable}"
          fork         ="${build.rupile.fork}"
      debug        ="${build.rupile.debug}"
      depend       ="${build.rupile.depend}"
      deprecation  ="${build.rupile.deprecation}"
      nowarn       ="${build.rupile.nowarn}" 
      optimize     ="${build.rupile.optimize}"
            source       ="${build.rupile.source}"
      target       ="${build.rupile.target}"
      verbose      ="${build.rupile.verbose}"
      bootclasspath="${build.boot.classpath}" />
  </target>
  
    <!-- ***************************************************************** -->
  <target name="compile-tests" depends="compile-core" if="junit.jar.present"
          description="Compiles the unit tests." >
        <mkdir dir="${build.test.dir}"/>
    <javac 
      srcdir       ="${src.test.dir}" 
      destdir      ="${build.test.dir}"
          encoding     ="${build.encoding}"
          executable   ="${build.rupile.executable}"
          fork         ="${build.rupile.fork}"
      debug        ="${build.rupile.debug}"
      depend       ="${build.rupile.depend}"
      deprecation  ="${build.rupile.deprecation}"
      nowarn       ="${build.rupile.nowarn}" 
      optimize     ="${build.rupile.optimize}"
            source       ="${build.rupile.source}"
      target       ="${build.rupile.target}"
      verbose      ="${build.rupile.verbose}"
      bootclasspath="${build.boot.classpath}" 
        classpathref ="classpath.tests" />
  </target>  
  
    <!-- ***************************************************************** -->
  <target name="compile-tutorial" depends="compile-core"
          description="Compiles the tutorial." >
    <javac 
      srcdir       ="${src.tutorial.dir}" 
      destdir      ="${build.tutorial.dir}"
          encoding     ="${build.encoding}"
          executable   ="${build.rupile.executable}"
          fork         ="${build.rupile.fork}"
      debug        ="${build.rupile.debug}"
      depend       ="${build.rupile.depend}"
      deprecation  ="${build.rupile.deprecation}"
      nowarn       ="${build.rupile.nowarn}" 
      optimize     ="${build.rupile.optimize}"
            source       ="${build.rupile.source}"
      target       ="${build.rupile.target}"
      verbose      ="${build.rupile.verbose}"
      bootclasspath="${build.boot.classpath}" 
        classpathref ="classpath.tutorial" />
  </target>
  
    <!-- ***************************************************************** -->
    <!-- J A V A D O C                                                     -->
    <!-- ***************************************************************** -->
    <target name="javadoc" depends="prepare" 
            description="Creates the API documentation using JavaDoc." >
    <mkdir dir="${build.javadocs.dir}"  />
        <javadoc 
          sourcepath="${src.core.dir}"
            packagenames="${javadoc.packages}"
          destdir="${build.javadocs.dir}"
          encoding="${build.encoding}"
            access="protected" 
            author="true" 
            version="true" 
            use="true" 
            link="${javadoc.link}"
            windowtitle="${Name} ${spec.version} API" 
            doctitle="${Name} ${spec.version} API"
            bottom="${copyright.message}" >
         </javadoc>
    </target>
    
    
    <!-- ***************************************************************** -->
    <!-- U N I T   T E S T S                                               -->
    <!-- ***************************************************************** -->
  <target name="test" depends="compile-tests" if="junit.task.present"
          description="Compiles and runs the unit tests." >
        <mkdir dir="${build.reports.dir}"/>
        <junit printsummary="yes" haltonfailure="no" >
            <classpath refid="classpath.tests"/>
            <formatter type="plain" />
            <batchtest fork="yes" todir="${build.reports.dir}">
                <fileset dir="${src.test.dir}" includes="**/*Test.java" />
            </batchtest>
        </junit>
  </target>
    
    
    <!-- ***************************************************************** -->
    <!-- J A R                                                      -->
    <!-- ***************************************************************** -->
  <target name="jar" depends="compile-core"
          description="Creates the library jar." >
    <jar 
      destfile="${build.core.jar}" >
      <fileset dir="${build.core.dir}" />
            <manifest>
                <attribute name ="Built-By" 
                           value="${user.name}"/>
                <attribute name ="Specification-Title"
                           value="${spec.title}" />
                <attribute name ="Specification-Version"
                           value="${spec.version}" />
                <attribute name ="Specification-Vendor"
                           value="${spec.vendor}" />
             <attribute name ="Implementation-Title"
                           value="${impl.title}" />
             <attribute name ="Implementation-Version"
                           value="${impl.version} ${DATE}" />
                <attribute name ="Implementation-Vendor"
                           value="${impl.vendor}" />
           </manifest>
    </jar>
  </target>
  
  
    <!-- ***************************************************************** -->
    <!-- P A C K A G E                                                     -->
    <!-- ***************************************************************** -->
  <target name="package" depends="clean, compile, javadoc, test, jar"
          description="Creates the distribution directory tree." >
  
    <mkdir dir="${dist.dir}" />
    
    <!-- Copy the examples. -->
        <!-- Copy the libraries. -->
        <copy todir="${dist.lib.dir}" >
            <fileset dir="${lib.dir}" 
                     includes="forms-*.jar, binding-*.jar, jlme*.jar"      />
        </copy>
        
    <!-- Copy the source directories. -->
    <copy todir="${dist.src.dir}" >
        <fileset dir="${src.dir}" 
             includes="examples/**/*, test/**/*, tutorial/**/*" />
    </copy>
    
    <!-- Copy the distribution files. -->
    <copy todir="${dist.dir}" >
      <fileset dir="${top.dir}" 
             includes="*.txt, *.html, *.xml, *.properties" 
             excludes="todo.txt" />
    </copy>
    <!-- Copy the library jar file. -->
    <copy tofile="${dist.core.jar}" file="${build.core.jar}" />
    
  </target>
    
    <!-- ***************************************************************** -->
    <!-- C R E A T E                                                       -->
    <!-- ***************************************************************** -->
    <target name="create-all" depends="create-dist-zip, create-maven-bundle"
            description="Creates the distribution zip and Maven bundle." >
    </target>   
  
    <target name="create-dist-dir" depends="clean, compile, javadoc, test, jar"
            description="Creates the distribution directory tree." >
    
        <mkdir dir="${dist.dir}" />
        
        <!-- Compile the documentation. -->
        <copy todir="${dist.docs.dir}" >
            <fileset dir="${docs.dir}"  
                     excludes="**/*.psd, **/*.sxw"     />
        </copy>
        <move todir="${dist.docs.dir}" file="${build.javadocs.dir}" />
        
        <!-- Copy the libraries. -->
        <copy todir="${dist.lib.dir}" >
            <fileset dir="${lib.dir}" 
                     includes="forms-*.jar, binding-*.jar"      />
        </copy>
        
        <!-- Copy the source directories. -->
        <copy todir="${dist.src.dir}" >
            <fileset dir="${src.dir}" 
                     excludes="unused,
                               unused/**/*"      />
        </copy>
        
        <!-- Copy the distribution files. -->
        <copy todir="${dist.dir}" >
            <fileset dir="${top.dir}" 
                     includes="*.txt, *.html, *.xml, *.properties" 
                     excludes="todo.txt" />
        </copy>
        <!-- Copy the library jar file. -->
        <copy tofile="${dist.core.jar}" file="${build.core.jar}" />
      
    </target>
    <!-- ***************************************************************** -->
    <target name="create-dist-zip" depends="create-dist-dir"
            description="Packages the distribution as a zip file." >
            
        <zip 
            destfile="${dist.zip}" 
            basedir="${dist.root.dir}"
            includes="${dist.subdir}/**/*" />
    </target>
    
    <!-- ***************************************************************** -->
    <target name="create-maven-bundle" depends="create-dist-dir"
            description="Creates a Maven bundle for the Ibiblio upload." >
            
        <!-- Copy the Maven pom template. -->
        <copy tofile="${dist.maven.pom}" file="${build.maven.pom.template}" />
        <!-- Replace the version in the pom.xml. -->
        <replace file="${dist.maven.pom}"
            token="@impl.version"
            value="${impl.version}" />   
        
        <copy tofile="${dist.maven.bin.jar}" file="${build.core.jar}" />
        <jar 
            destfile="${dist.maven.src.jar}"
            basedir="${dist.src.dir}" />   
        <jar 
            destfile="${dist.maven.bundle}" 
            basedir="${build.maven.dir}" />
    </target>
    
</project>





Ant target:compile

  
<?xml version="1.0"?>
<project name="sample" default="test" basedir=".">
   <target name="compile">
      <mkdir dir="build"/>
      <javac destdir="build"
             debug="on"
             optimize="on">
         <src path="src"/>
      </javac>
   </target>
   <target name="test" depends="compile">
      <java fork="no" failonerror="yes"
            classname="test.TestSample"
            classpath="build">  
          <arg line=""/>
      </java>
   </target>
   <target name="clean">
      <delete dir="build"/>
   </target>
</project>





Compile the stand-alone application

  
<?xml version="1.0"?>
<project name="Example Application Build" default="build-both" basedir=".">
  
  <property file="build.properties"/>
  <!-- CVSROOT for the JSTL -->
  <property name="cvsroot" value=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" />
  <!-- CVSROOT for the MySQL connector -->
  <property name="mysql.cvsroot" value=":pserver:anonymous@cvs.sourceforge.net:/cvsroot/mmmysql" />
  <!-- The master build classpath          --> 
  <path id="build.classpath">
    <pathelement location="${servlet24.jar}"/>
    <pathelement location="${jsp20.jar}"/>
    <pathelement location="${mysql.jar}"/>
    <pathelement path="${appName.jar}"/>
  </path>

  <!-- Initialization target --> 
  <!-- Create the working directories -->
  <target name="dir" description="Create the working directories">
    <echo message="Creating the working directories"/>
    <mkdir dir="${build.stand-alone.root}"/>
    <mkdir dir="${build.web.classes}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${lib}"/>
  </target>

  <!-- CVS and build tasks for the JSTL and MySQL connector -->
  <!-- Update or check out required sources from CVS for the JSTL -->
  <target name="checkout-jstl" depends="dir" 
          description="Update or check out required sources
                       from CVS for the JSTL">
    <echo message="Checking out the required JSTL sources from CVS"/>
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${jstl.build}" 
         dest="${build}" compression="true" />
  </target>
  
  
  <!-- Update or check out required sources from CVS for the MySQL connector -->
  <target name="checkout-mysql-connector" depends="dir" 
          description="Update or check out required sources
          from CVS for the MySQL connector">
    <echo message="Checking out the required sources from CVS for the MySQL connector" />
    <cvs cvsroot="${mysql.cvsroot}" quiet="true"
         command="checkout" package="${mysql.build}"
         dest="${build}" compression="true" />
  </target>
  <!-- Build the JSTL from source -->
  <target name="build-jstl" depends="checkout-jstl" 
          description="Build the JSTL from source">
    <echo message="Building the JSTL from source"/>
    <ant antfile="build.xml" dir="${build}/${jstl.build}"/>
    <copy todir="${lib}">
      <fileset dir="${build}/${jstl.build}/${build}/lib">
        <include name="*.jar"/>
      </fileset>
    </copy>
  </target>
  <!-- Build the MySQL connector from source -->
  <target name="build-mysql-connector" depends="checkout-mysql-connector" 
          description="Build the MySQL connector from source">
    <echo message="Building the MySQL connector from source"/>
    <!-- The MySQL connector file needs this directory to exist -->
    <!-- Therefore we need to create it -->
    <mkdir dir="${build}/dist-mysql-jdbc"/>
    <ant antfile="build.xml" dir="${build}/${mysql.build}"/>
    <copy tofile="${mysql.jar}">
      <fileset dir="${build}/build-mysql-jdbc">
        <include name="mysql-connector*/*.jar"/>
      </fileset>
    </copy>
  </target>

  <!-- Compile the stand-alone application -->
  <target name="compile-stand-alone" depends="dir" 
          description="Compile stand-alone application">
    <echo message="Compiling the stand-alone application"/>
    <javac srcdir="${src.shared.java}" destdir="${build.stand-alone.root}"/>
    <javac srcdir="${src.stand-alone.java}" 
           destdir="${build.stand-alone.root}"/>  
  </target>
<!--
  <target name="stand-alone-complete" 
          description="Compile stand-alone application, 
          using CVS version of the MySQL connector">
    <echo message="Compiling stand-alone application, using CVS versions of the MySQL connector"/>
    <antcall target="build-mysql-connector"/>
    <antcall target="package-stand-alone"/>
  </target>
  <target name="stand-alone-complete" 
          depends="build-mysql-connector, package-stand-alone" 
          description="Compile stand-alone application, 
          using CVS version of the MySQL connector">
    <echo message="Compiling stand-alone application, using CVS versions of the MySQL connector"/>
  </target> 
-->
  <target name="stand-alone-complete" 
          depends="build-mysql-connector, package-stand-alone" 
          description="Compile stand-alone application, 
                       using CVS version of the MySQL connector">
    <echo message="Compiling stand-alone application, using CVS versions of the MySQL connector"/>
  </target>
  <!-- Package the stand-alone application -->
  <target name="package-stand-alone" depends="compile-stand-alone" 
          description="Package the stand-alone application">
    <echo message="Creating the stand-alone JAR file"/>
    <copy file="${database.properties}" todir="${build.stand-alone.root}"/>
    <jar destfile="${appName.jar}" basedir="${build.stand-alone.root}"/>
  </target>
  <!-- Compile the web application -->
  <target name="compile-web" depends="dir" description="Compile web application">
    <echo message="Compiling the web application"/>
    <javac destdir="${build.web.classes}">
      <src path="${src.shared.java}"/>
    </javac>
    <javac srcdir="${src.web.java}" destdir="${build.web.classes}">
      <classpath refid="build.classpath"/>
    </javac>
  </target>
<!--
  <target name="web-complete" 
          description="Compile web application, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling web application, using CVS versions of the MySQL connector and the JSTL"/>
    <antcall target="build-mysql-connector"/>
    <antcall target="build-jstl"/>
    <antcall target="package-web"/>
  </target>
  <target name="web-complete" 
          depends="build-mysql-connector, build-jstl, package-web" 
          description="Compile web application, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiled web application, using CVS versions of the MySQL connector and the JSTL"/>
  </target>
-->
  <target name="web-complete" 
          depends="build-mysql-connector, build-jstl, package-web" 
          description="Compile web application, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling web application, using CVS versions of the MySQL connector and the JSTL"/>
  </target>
  <!-- Copy the web pages and configuration files -->
  <target name="copy-web" depends="compile-web" description="Copy the web files">
    <echo message="Copying the web pages and configuration files"/>
    <copy todir="${build.web.root}">
      <fileset dir="${src.web.pages}"/>
    </copy>
    <!-- Copy the tags -->
    <copy todir="${build.web.tags}">
      <fileset dir="${src.web.tags}"/>
    </copy>
    <copy todir="${build.web.web-inf}">
      <fileset dir="${src.web.conf}">
        <include name="*.tld"/>
      </fileset>
    </copy>
    <!-- Copy the JAR files -->
    <copy todir="${build.web.lib}">
      <fileset dir="${lib}"/>
    </copy>
    <!-- Copy the properties file -->
    <copy file="${database.properties}" todir="${build.web.classes}"/>
    <!-- No need to copy web.xml, as the WAR task does this for us -->
  </target>
  <!-- Build the WAR file -->
  <target name="package-web" depends="copy-web" description="Build the WAR">
    <echo message="Building the WAR file"/> 
    <war destfile="${appName.war}" basedir="${build.web.root}" 
         webxml="${src.web.conf}/web.xml"/>
  </target>

  <!-- Targets that work with both applications -->
<!--
  <target name="build-both" 
          description="Compile both applications, 
                       without CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling both applications, without CVS versions of the MySQL connector and the JSTL"/>
    <antcall target="package-stand-alone"/>
    <antcall target="package-web"/>
  </target>
  <target name="build-all" 
          description="Compile both applications, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling both applications, using CVS versions of the MySQL connector and the JSTL"/>
    <antcall target="stand-alone-complete"/>
    <antcall target="web-complete"/>
  </target>
-->
  <target name="build-both" 
          depends="package-stand-alone, package-web" 
          description="Compile both applications, 
                       without CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiled both applications, without CVS versions of the MySQL connector and the JSTL"/>
  </target>
  <target name="build-all" 
          depends="stand-alone-complete, web-complete" 
          description="Compile both applications, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiled both applications, using CVS versions of the MySQL connector and the JSTL"/>
  </target>

  <!-- Download the servlet JAR -->
  <target name="download-servlet-jar" depends="dir" 
          description="Download the servlet JAR">
    <echo message="Downloading the servlet JAR"/>
    <get src="http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.4.jar"
         dest="${servlet24.jar}"
         verbose="true"/>
  </target>
  <!-- Download the JSP JAR -->
  <target name="download-jsp-jar" depends="dir" 
          description="Download the JSP JAR">
    <echo message="Downloading the JSP JAR"/>
    <get src="http://www.ibiblio.org/maven/jspapi/jars/jsp-api-2.0.jar"
         dest="${jsp20.jar}"
         verbose="true"/>
  </target>
  <target name="clean" description="Clean up the working directories">
    <echo message="Cleaning up"/>
    <delete dir="${build}"/>
  </target>
</project>





Compile the web application

  
<?xml version="1.0"?>
<project name="Example Application Build" default="build-both" basedir=".">
  
  <property file="build.properties"/>
  <!-- CVSROOT for the JSTL -->
  <property name="cvsroot" value=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" />
  <!-- CVSROOT for the MySQL connector -->
  <property name="mysql.cvsroot" value=":pserver:anonymous@cvs.sourceforge.net:/cvsroot/mmmysql" />
  <!-- The master build classpath          --> 
  <path id="build.classpath">
    <pathelement location="${servlet24.jar}"/>
    <pathelement location="${jsp20.jar}"/>
    <pathelement location="${mysql.jar}"/>
    <pathelement path="${appName.jar}"/>
  </path>

  <!-- Initialization target --> 
  <!-- Create the working directories -->
  <target name="dir" description="Create the working directories">
    <echo message="Creating the working directories"/>
    <mkdir dir="${build.stand-alone.root}"/>
    <mkdir dir="${build.web.classes}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${lib}"/>
  </target>

  <!-- CVS and build tasks for the JSTL and MySQL connector -->
  <!-- Update or check out required sources from CVS for the JSTL -->
  <target name="checkout-jstl" depends="dir" 
          description="Update or check out required sources
                       from CVS for the JSTL">
    <echo message="Checking out the required JSTL sources from CVS"/>
    <cvs cvsroot="${cvsroot}" quiet="true"
         command="checkout -P ${jstl.build}" 
         dest="${build}" compression="true" />
  </target>
  
  
  <!-- Update or check out required sources from CVS for the MySQL connector -->
  <target name="checkout-mysql-connector" depends="dir" 
          description="Update or check out required sources
          from CVS for the MySQL connector">
    <echo message="Checking out the required sources from CVS for the MySQL connector" />
    <cvs cvsroot="${mysql.cvsroot}" quiet="true"
         command="checkout" package="${mysql.build}"
         dest="${build}" compression="true" />
  </target>
  <!-- Build the JSTL from source -->
  <target name="build-jstl" depends="checkout-jstl" 
          description="Build the JSTL from source">
    <echo message="Building the JSTL from source"/>
    <ant antfile="build.xml" dir="${build}/${jstl.build}"/>
    <copy todir="${lib}">
      <fileset dir="${build}/${jstl.build}/${build}/lib">
        <include name="*.jar"/>
      </fileset>
    </copy>
  </target>
  <!-- Build the MySQL connector from source -->
  <target name="build-mysql-connector" depends="checkout-mysql-connector" 
          description="Build the MySQL connector from source">
    <echo message="Building the MySQL connector from source"/>
    <!-- The MySQL connector file needs this directory to exist -->
    <!-- Therefore we need to create it -->
    <mkdir dir="${build}/dist-mysql-jdbc"/>
    <ant antfile="build.xml" dir="${build}/${mysql.build}"/>
    <copy tofile="${mysql.jar}">
      <fileset dir="${build}/build-mysql-jdbc">
        <include name="mysql-connector*/*.jar"/>
      </fileset>
    </copy>
  </target>

  <!-- Compile the stand-alone application -->
  <target name="compile-stand-alone" depends="dir" 
          description="Compile stand-alone application">
    <echo message="Compiling the stand-alone application"/>
    <javac srcdir="${src.shared.java}" destdir="${build.stand-alone.root}"/>
    <javac srcdir="${src.stand-alone.java}" 
           destdir="${build.stand-alone.root}"/>  
  </target>
<!--
  <target name="stand-alone-complete" 
          description="Compile stand-alone application, 
          using CVS version of the MySQL connector">
    <echo message="Compiling stand-alone application, using CVS versions of the MySQL connector"/>
    <antcall target="build-mysql-connector"/>
    <antcall target="package-stand-alone"/>
  </target>
  <target name="stand-alone-complete" 
          depends="build-mysql-connector, package-stand-alone" 
          description="Compile stand-alone application, 
          using CVS version of the MySQL connector">
    <echo message="Compiling stand-alone application, using CVS versions of the MySQL connector"/>
  </target> 
-->
  <target name="stand-alone-complete" 
          depends="build-mysql-connector, package-stand-alone" 
          description="Compile stand-alone application, 
                       using CVS version of the MySQL connector">
    <echo message="Compiling stand-alone application, using CVS versions of the MySQL connector"/>
  </target>
  <!-- Package the stand-alone application -->
  <target name="package-stand-alone" depends="compile-stand-alone" 
          description="Package the stand-alone application">
    <echo message="Creating the stand-alone JAR file"/>
    <copy file="${database.properties}" todir="${build.stand-alone.root}"/>
    <jar destfile="${appName.jar}" basedir="${build.stand-alone.root}"/>
  </target>
  <!-- Compile the web application -->
  <target name="compile-web" depends="dir" description="Compile web application">
    <echo message="Compiling the web application"/>
    <javac destdir="${build.web.classes}">
      <src path="${src.shared.java}"/>
    </javac>
    <javac srcdir="${src.web.java}" destdir="${build.web.classes}">
      <classpath refid="build.classpath"/>
    </javac>
  </target>
<!--
  <target name="web-complete" 
          description="Compile web application, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling web application, using CVS versions of the MySQL connector and the JSTL"/>
    <antcall target="build-mysql-connector"/>
    <antcall target="build-jstl"/>
    <antcall target="package-web"/>
  </target>
  <target name="web-complete" 
          depends="build-mysql-connector, build-jstl, package-web" 
          description="Compile web application, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiled web application, using CVS versions of the MySQL connector and the JSTL"/>
  </target>
-->
  <target name="web-complete" 
          depends="build-mysql-connector, build-jstl, package-web" 
          description="Compile web application, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling web application, using CVS versions of the MySQL connector and the JSTL"/>
  </target>
  <!-- Copy the web pages and configuration files -->
  <target name="copy-web" depends="compile-web" description="Copy the web files">
    <echo message="Copying the web pages and configuration files"/>
    <copy todir="${build.web.root}">
      <fileset dir="${src.web.pages}"/>
    </copy>
    <!-- Copy the tags -->
    <copy todir="${build.web.tags}">
      <fileset dir="${src.web.tags}"/>
    </copy>
    <copy todir="${build.web.web-inf}">
      <fileset dir="${src.web.conf}">
        <include name="*.tld"/>
      </fileset>
    </copy>
    <!-- Copy the JAR files -->
    <copy todir="${build.web.lib}">
      <fileset dir="${lib}"/>
    </copy>
    <!-- Copy the properties file -->
    <copy file="${database.properties}" todir="${build.web.classes}"/>
    <!-- No need to copy web.xml, as the WAR task does this for us -->
  </target>
  <!-- Build the WAR file -->
  <target name="package-web" depends="copy-web" description="Build the WAR">
    <echo message="Building the WAR file"/> 
    <war destfile="${appName.war}" basedir="${build.web.root}" 
         webxml="${src.web.conf}/web.xml"/>
  </target>

  <!-- Targets that work with both applications -->
<!--
  <target name="build-both" 
          description="Compile both applications, 
                       without CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling both applications, without CVS versions of the MySQL connector and the JSTL"/>
    <antcall target="package-stand-alone"/>
    <antcall target="package-web"/>
  </target>
  <target name="build-all" 
          description="Compile both applications, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiling both applications, using CVS versions of the MySQL connector and the JSTL"/>
    <antcall target="stand-alone-complete"/>
    <antcall target="web-complete"/>
  </target>
-->
  <target name="build-both" 
          depends="package-stand-alone, package-web" 
          description="Compile both applications, 
                       without CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiled both applications, without CVS versions of the MySQL connector and the JSTL"/>
  </target>
  <target name="build-all" 
          depends="stand-alone-complete, web-complete" 
          description="Compile both applications, 
                       using CVS versions of the MySQL connector and the JSTL">
    <echo message="Compiled both applications, using CVS versions of the MySQL connector and the JSTL"/>
  </target>

  <!-- Download the servlet JAR -->
  <target name="download-servlet-jar" depends="dir" 
          description="Download the servlet JAR">
    <echo message="Downloading the servlet JAR"/>
    <get src="http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.4.jar"
         dest="${servlet24.jar}"
         verbose="true"/>
  </target>
  <!-- Download the JSP JAR -->
  <target name="download-jsp-jar" depends="dir" 
          description="Download the JSP JAR">
    <echo message="Downloading the JSP JAR"/>
    <get src="http://www.ibiblio.org/maven/jspapi/jars/jsp-api-2.0.jar"
         dest="${jsp20.jar}"
         verbose="true"/>
  </target>
  <target name="clean" description="Clean up the working directories">
    <echo message="Cleaning up"/>
    <delete dir="${build}"/>
  </target>
</project>





Javac include and exclude

 
<!--
  About this file (build.xml):
  Last modified 2001-11-30
  Author        Matthias Beil
  Contributor   Guillaume Desnoix
  License       GNU General Public License 2 (GPL2)
                Copyright (c) 2001 Matthias Beil
                All rights reserved.
-->
<!--  -->
<project name="alma" default="main" basedir="." >

<!--  -->
<!-- Set up application values -->
<property name="app.name"    value="alma" />
<property name="app.package" value="com/memoire" />
<property name="app.version" value="0.36" />
<property name="app.year"    value="2001" />

<!--  -->
<!-- directory locations -->
<property name="dir.classes"        location="classes" />
<property name="dir.dist"           location="dist" />
<property name="dir.javadocs"       location="docs" />
<property name="dir.project"        location="." />
<property name="dir.src"            location="." />
<property name="dir.package" value="com/memoire" />
<!-- debug setting -->
<property name="debug" value="on"/>
<!-- javadoc package -->
<property name="packages" value="com.memoire.*"/>

<!--  -->
<!-- Show System JVM -->
<target name="showsystem" >
   <!-- might not work!? -->
   <showsystem />
</target>

<!--  -->
<!-- Create necessary directories -->
<target name="prepare">
   <tstamp />
   <mkdir dir="${dir.classes}" />
   <mkdir dir="${dir.dist}" />
</target>

<!--  -->
<!-- Compiles the java source files -->
<target name="compile" depends="prepare">
   <javac
      srcdir="${dir.src}"
      destdir="${dir.classes}"
      classpath="${dir.src}"
      debug="${debug}"
      failonerror="no" >
      <include name="com/memoire/acme/Acme*.java"/>
      <include name="com/memoire/re/RE*.java"/>
      <include name="com/memoire/mst/Mst*.java"/>
      <include name="com/memoire/pbc/Pbc*.java"/>
      <include name="com/memoire/fu/Fu*.java"/>
      <include name="com/memoire/dnd/Dnd*.java"/>
      <include name="com/memoire/xml/Xml*.java"/>
      <include name="com/memoire/yapod/Yapod*.java"/>
      <include name="com/memoire/bu/Bu*.java"/>
      <include name="com/memoire/dja/Dja*.java"/>
      <include name="com/memoire/agl/Agl*.java"/>
      <include name="com/memoire/alma/Alma*.java"/>
      <include name="com/memoire/jedit/JEdit*.java"/>
      <include name="com/memoire/editor/Editor*.java"/>
      <include name="com/memoire/foo/Foo*.java"/>
      <include name="com/memoire/silk/Silk*.java"/>
      <include name="com/memoire/script/Script*.java"/>
      <exclude name="com/memoire/ant/*.java"/>
      <exclude name="com/memoire/editor/EditorJext.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterBeanshell.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterDawn.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterFiji.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterFoo.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterPnuts.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterPython.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterRhino.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterRuby.java"/>
   </javac>
</target>

<!--  -->
<!-- Creates the jar file for distribution -->
<target name="dist" depends="compile">
   <jar jarfile="${dir.dist}/${app.name}.jar"
        manifest="manifest-alma.txt" >
      <fileset dir="${dir.classes}" >
         <patternset>
            <exclude name="**/dependency cache"/>
         </patternset>
      </fileset>
      <fileset dir="${dir.src}" >
         <patternset>
            <include name="**/*.dja"/>
            <include name="**/*.foo"/>
            <include name="**/*.gif"/>
            <include name="**/*.txt"/>
         </patternset>
      </fileset>
   </jar>
</target>

<!--  -->
<!-- Compile and build a distribution -->
<target name="main" depends="compile, dist" >
   <echo>Alma application package created</echo>
</target>

<!--  -->
<!-- Create the API documentation -->
<target name="javadocs" depends="prepare">
   <mkdir dir="${dir.javadocs}"/>
   <javadoc packagenames="${packages}"
            sourcepath="${dir.src}"
            destdir="${dir.javadocs}"
            classpath="${dir.src}"
            author="true"
            version="true"
            use="true"
            windowtitle="${app.name} API"
            doctitle="&lt;h1&gt;${app.name}&lt;/h1&gt;"
   />
</target>

<!--  -->
<!-- Deletes the build and dist directories -->
<target name="clean" >
   <delete dir="${dir.dist}" />
   <delete dir="${dir.classes}" />
</target>

<!--  -->
<target name="all" depends="clean,main,javadocs" >
   <echo>Alma application package cleaned and created</echo>
</target>

<!--  -->
<!-- run application -->
<target name="app-run" depends="main" >
   <java classname="com.memoire.alma.Alma"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>
<target name="run-alma" depends="main" >
   <java classname="com.memoire.alma.Alma"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>
<target name="run-dja" depends="main" >
   <java classname="com.memoire.dja.Dja"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>
<target name="run-agl" depends="main" >
   <java classname="com.memoire.agl.Agl"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>
<target name="run-foo" depends="main" >
   <java classname="com.memoire.foo.Foo"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>
<target name="run-reformatage" depends="main" >
   <java classname="com.memoire.agl.AglOutilReformatage"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>
<target name="run-coloration" depends="main" >
   <java classname="com.memoire.agl.AglOutilColoration"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

</project>





Javac with classpath

 
<?xml version="1.0"?>
<project name="yourName" default="junitgui" basedir=".">
  <property name="junitJar" value="\junit3.8.1\junit.jar" />
  <property name="src.dir" value="${basedir}\src" />
  <property name="build.dir" value="${basedir}\classes" />
  <path id="classpath">
    <pathelement location="${junitJar}" />
    <pathelement location="${build.dir}" />
  </path>
  <target name="init">
    <mkdir dir="${build.dir}" />
  </target>
  <target name="build" depends="init" description="build all">
    <javac
        srcdir="${src.dir}" destdir="${build.dir}"
        source="1.5" 
        deprecation="on" debug="on" optimize="off" includes="**">
      <classpath refid="classpath" />
    </javac>
  </target>
  <target name="junitgui" depends="build" description="run junitgui">
    <java classname="junit.awtui.TestRunner" fork="yes">
      <arg value="sis.AllTests" />
      <classpath refid="classpath" />
    </java>
  </target>
   <target name="clean">  
    <delete dir="${build.dir}" />
  </target>
   <target name="rebuildAll" depends="clean,build" description="rebuild all"/>
</project>





Javac with encoding

 
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.    
#
# This file is used by build.xml 
#
# Global defaults
name=          Anakia
project=       anakia
version=       1.0
final.name=    ${project}-${version}
root.package=  org.apache.anakia
# compile switches
debug= on
optimize= on
deprecation= off
ant.build.dir= build
build.dir= ${app.dir}/bin
# The source tree runs through a filter copy task to
# allow substitution of version, date etc. and will
# end up in build.src
build.lib=       ${build.dir}/lib
build.test.lib=  ${build.dir}/test-lib
build.dest=      ${build.dir}/classes
build.test.dest= ${build.dir}/test-classes
build.javadoc=   ${build.dir}/apidocs
build.test=      ${build.dir}/test
build.docs=      ${build.dir}/docs
# Various local pathes in the distribution
src.java.dir=  ${app.dir}/src/java
test.java.dir= ${app.dir}/src/test
test.dir=      ${app.dir}/test
example.dir=   ${app.dir}/examples
xdocs.dir=     ${app.dir}/xdocs
# Running the tests
test.haltonerror= true
test.haltonfailure= true
# Building the distribution
dist.root= ${build.dir}/dist
dist.dir= ${dist.root}/${final.name}
# Set to Sun Javadocs
javadocs.ref.jsdk= http://java.sun.ru/j2se/1.4.2/docs/api/
# for the javadoc
javadoc.packagenames = ${root.package}.*
# attributes for the jar manifest
mf.package = ${root.package}
mf.extension.name = ${project}
mf.specification.title = Anakia is a XML-based text processor
mf.specification.vendor = Apache Software Foundation
mf.implementation.title = ${mf.package}
mf.implementation.vendor.id = org.apache
mf.implementation.vendor = Apache Software Foundation
mf.implementation.version = ${version}

# #######################################################################
#
# Downloading jars from ibiblio repository
#
# #######################################################################
# The default behaviour is to download dependency jars only when
# they are not already present.
# Set skip.jar.loading to true to never download any dependency jar,
# or force.jar.loading to true to always download all dependency jars.
skip.jar.loading= false
force.jar.loading= false
#
# Settings for the proxy to use for download. Change this if you must
# use a proxy from your host. If the proxy.host property is unset, no
# proxy is used.
proxy.host=
proxy.port= 80
#
# We download directly from the ibiblio maven repository
repo.url= http://www.ibiblio.org/maven
#
# Jars to be downloaded
jar.antlr.version= 2.7.5
jar.rumons-collections.version= 3.1
jar.rumons-lang.version= 2.1
jar.jdom.version= 1.0
jar.werken-xpath.version= 0.9.4
jar.junit.version= 3.8.1
jar.velocity.version= 1.5

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
   http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.    
-->
<!-- Build file for project -->
<!-- This project has its basedir set to the root directory   -->
<!-- of the project distribution. This is necessary so that   -->
<!-- all the code that uses relative directory references     -->
<!-- (like the tests) can be run in the same way when using   -->
<!-- the ant based build and the maven based build.           -->
<!-- *** DO NOT CHANGE THIS SETTING LIGHTLY! ***              -->
<project name="Anakia" default="world" basedir="..">
  <path id="basedir-os">
    <pathelement location="${basedir}" />
  </path>
  <!-- This is the relative base dir. This must be the root of the   -->
  <!-- distribution. All relative pathes are prefixed with      -->
  <!-- app.dir                                                  -->
  <pathconvert property="app.dir" refid="basedir-os" targetos="unix"/>
  <!-- Give user a chance to override without editing this file
       (and without typing -D each time it compiles it -->
  <property file="${user.home}/.ant.properties" />
  <property file="${user.home}/build.properties" />
  <property file=".ant.properties" />
  <!-- This file contains all the defaults for the build  -->
  <property file="build/build.properties" />

  <property name="test.runner" value="junit.textui.TestRunner"/>
  <target name="world" depends="jar,test,javadocs,docs,env"
          description="Build the project jar and documentation"/>
  
  <!-- prints the environment                                              -->
  
  <target name="env" description="Prints build parameters">
    <echo>
  Global settings:
    java.home = ${java.home}
    user.home = ${user.home}
    java.class.path = ${java.class.path}
  Project settings:
    Version:     ${version}
    Debug:       ${debug}
    Optimize:    ${optimize}
    Deprecation: ${deprecation}
  Target settings (relative to build tree root):
    Classes:      ${build.dest}
    API Docs:     ${build.javadoc}
    Docs:         ${build.docs}
    </echo>
  </target>
  
  <!-- Prepares the build directory                                        -->
  
  <target name="prepare" depends="basic-prepare"/>
  
  <!-- sets up the build trees for sources and tests                       -->
  
  <target name="basic-prepare">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.test.dest}"/>
  </target>
  
  <!-- sets up the build environment (classpath and libs)                  -->
  
  <target name="build-prepare" depends="basic-prepare">
    <ant antfile="${ant.build.dir}/download.xml" target="build-download" />
    <!-- Build classpath -->
    <path id="build.classpath">
      <fileset dir="${build.lib}">
        <include name="**/*.jar"/>
      </fileset>
    </path>
    <!-- Test classpath, contains dependencies needed only for Testing -->
    <path id="test.classpath">
        <fileset dir="${build.test.lib}">
          <include name="**/*.jar"/>
        </fileset>
        <fileset dir="${build.lib}">
          <include name="**/*.jar"/>
        </fileset>
        <pathelement location="${build.dest}" />
        <pathelement location="${build.test.dest}" />
    </path>
    <path id="run.classpath">
      <path refid="build.classpath"/>
      <pathelement location="${build.dir}/${final.name}.jar"/>
    </path>
  </target>
  
  <!-- Compiles the source tree and the tests                              -->
  
  <target name="compile" depends="compile-src,compile-test"/>
  <target name="compile-src" depends="build-prepare"
          description="Compiles the source">
    <javac srcdir="${src.java.dir}"
      destdir="${build.dest}"
      encoding="UTF-8"
      debug="${debug}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      classpathref="build.classpath"/>
    <copy todir="${build.dest}" filtering="yes">
      <fileset dir="${src.java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>
  </target>
  <target name="compile-test" depends="build-prepare,compile-src"
          description="Compiles the test classes">
    <javac srcdir="${test.java.dir}"
      destdir="${build.test.dest}"
      encoding="UTF-8"
      debug="${debug}"
      deprecation="${deprecation}"
      optimize="${optimize}">
      <!-- Don"t use the run classpath, build using the exploded class tree -->
      <classpath>
        <path refid="build.classpath"/>
        <path refid="test.classpath" />
        <pathelement location="${build.dest}"/>
      </classpath>
    </javac>
    <copy todir="${build.test.dest}" filtering="yes">
      <fileset dir="${test.java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>
  </target>

  
  <!-- Compiles the source directory and creates a .jar file               -->
  
  <target name="jar" depends="compile-src"
          description="Builds the Jar file">
    <property name="jarname" value="${final.name}" />
    <jar jarfile="${build.dir}/${jarname}.jar">
      <metainf dir="${app.dir}">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </metainf>
      <fileset dir="${build.dest}"/>
      <manifest>
        <attribute name="Created-By" value="Apache Ant"/>
        <attribute name="Build-Jdk" value="${java.version}"/>
        <attribute name="Package" value="${mf.package}"/>
        <attribute name="Extension-Name" value="${mf.extension.name}"/>
        <attribute name="Specification-Title" value="${mf.specification.title}" />
        <attribute name="Specification-Vendor" value="${mf.specification.vendor}"/>
        <attribute name="Implementation-Title" value="${mf.implementation.title}"/>
        <attribute name="Implementation-Vendor-Id" value="${mf.implementation.vendor.id}"/>
        <attribute name="Implementation-Vendor" value="${mf.implementation.vendor}"/>
        <attribute name="Implementation-Version" value="${mf.implementation.version}"/>
      </manifest>
    </jar>
    <checksum file="${build.dir}/${jarname}.jar" algorithm="md5" property="checksum.jar.md5"/>
    <checksum file="${build.dir}/${jarname}.jar" algorithm="sha1" property="checksum.jar.sha1"/>
    <echo message="${checksum.jar.md5} *${jarname}.jar" file="${build.dir}/${jarname}.jar.md5" />
    <echo message="${checksum.jar.sha1} *${jarname}.jar" file="${build.dir}/${jarname}.jar.sha1" />
  </target>
  
  <!-- jars the source                                                    -->
  
  <target name="jar-src"
          depends="prepare"
          description="Builds the Source Jar File">
    <jar jarfile="${build.dir}/${final.name}-src.jar">
      <metainf dir="${app.dir}">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </metainf>
      <fileset dir="${src.java.dir}"/>
      <manifest>
        <attribute name="Created-By" value="Apache Ant"/>
        <attribute name="Specification-Title" value="${mf.specification.title}" />
        <attribute name="Specification-Vendor" value="${mf.specification.vendor}"/>
        <attribute name="Implementation-Title" value="${mf.implementation.title}"/>
        <attribute name="Implementation-Vendor-Id" value="${mf.implementation.vendor.id}"/>
        <attribute name="Implementation-Vendor" value="${mf.implementation.vendor}"/>
        <attribute name="Implementation-Version" value="${mf.implementation.version}"/>
      </manifest>
    </jar>
    <checksum file="${build.dir}/${final.name}-src.jar" algorithm="md5" property="checksum.jar-src.md5"/>
    <checksum file="${build.dir}/${final.name}-src.jar" algorithm="sha1" property="checksum.jar-src.sha1"/>
    <echo message="${checksum.jar-src.md5} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.md5" />
    <echo message="${checksum.jar-src.sha1} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.sha1" />
  </target>
  
  <!-- Creates the API documentation                                       -->
  
  <target name="javadocs" depends="build-prepare"
          description="Creates the Javadoc API documentation">
    <mkdir dir="${build.javadoc}"/>
    <javadoc sourcepath="${src.java.dir}"
             packagenames="${javadoc.packagenames}"
             destdir="${build.javadoc}"
             author="true"
             private="false"
             version="true"
             use="true"
             windowtitle="${name} ${version} API"
             doctitle="${name} ${version} API"
             encoding="UTF-8"
             docencoding="UTF-8"
             bottom="Copyright &#169; 2000-${build.year} &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache Software Foundation&lt;/a&gt;. All Rights Reserved."
             classpathref="build.classpath">
      <link href="${javadocs.ref.jsdk}"/>
      <link href="http://www.jdom.org/docs/apidocs"/>
      <link href="http://logging.apache.org/log4j/docs/api"/>
      <link href="http://excalibur.apache.org/apidocs"/>
      <link href="http://tomcat.apache.org/tomcat-4.1-doc/servletapi"/>
      <link href="http://jakarta.apache.org/oro/api"/>
      <link href="http://jakarta.apache.org/commons/lang/api-release"/>
      <link href="http://jakarta.apache.org/commons/collections/api-release"/>
    </javadoc>
  </target>
  <target name="javadocs-clean">
    <delete dir="${build.javadoc}" quiet="true"/>
  </target>
  
  <!-- Package                                                             -->
  
  <target name="build-package-tree" depends="clean,jar,docs,javadocs">

    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${dist.dir}/src/java"/>
    <copy todir="${dist.dir}/src/java/">
      <fileset dir="${src.java.dir}" />
    </copy>
    <copy todir="${dist.dir}/src/test/">
      <fileset dir="${test.java.dir}" />
    </copy>
    <copy todir="${dist.dir}/lib">
      <fileset dir="${build.lib}" />
    </copy>
    <copy todir="${dist.dir}/lib/test">
      <fileset dir="${build.test.lib}" />
    </copy>
    <copy todir="${dist.dir}/build">
      <fileset dir="${app.dir}/build">
        <include name="**"/>
        <exclude name="velocity.log"/>
      </fileset>
    </copy>
    <!-- Copy docs, exclude API docs -->
    <copy todir="${dist.dir}/docs">
      <fileset dir="${build.docs}">
        <include name="**"/>
        <exclude name="docs/api/**"/>
      </fileset>
    </copy>
    <!-- Add freshly built Java docs -->
    <copy todir="${dist.dir}/docs/api">
      <fileset dir="${build.javadoc}">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}/test">
      <fileset dir="${app.dir}/test">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}/xdocs">
      <fileset dir="${xdocs.dir}">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}">
      <fileset dir="${app.dir}">
        <include name="LICENSE" />
        <include name="NOTICE" />
        <include name="README.txt" />
        <include name="pom.xml" />
      </fileset>
    </copy>
    <copy
      file="${build.dir}/${final.name}.jar"
      tofile="${dist.dir}/${final.name}.jar"
    />
  </target>
  
  <!-- Packages the distribution with ZIP                                 -->
  
  <target name="package-zip"
          depends="build-package-tree">
    <!-- .zip built for Windows -->
    <fixcrlf srcdir="${dist.dir}" eol="crlf" eof="asis" encoding="ISO-8859-1">
      <include name="**/*.html" />
      <include name="**/*.java" />
      <include name="**/*.properties" />
      <include name="**/*.txt" />
      <include name="**/*.xml" />
    </fixcrlf>
    <delete file="${build.dir}/${final.name}.zip" quiet="true"/>
    <zip zipfile="${build.dir}/${final.name}.zip" basedir="${dist.root}"
         includes="**/${final.name}/**"/>
    <checksum file="${build.dir}/${final.name}.zip" algorithm="md5" property="checksum.zip.md5"/>
    <checksum file="${build.dir}/${final.name}.zip" algorithm="sha1" property="checksum.zip.sha1"/>
    <echo message="${checksum.zip.md5} *${final.name}.zip" file="${build.dir}/${final.name}.zip.md5" />
    <echo message="${checksum.zip.sha1} *${final.name}.zip" file="${build.dir}/${final.name}.zip.sha1" />
  </target>
  
  <!-- Packages the distribution with TAR-GZIP                            -->
  
  <target name="package-tgz"
          depends="build-package-tree">
    <!-- .tar.gz built for Unix -->
    <fixcrlf srcdir="${dist.dir}" eol="lf" eof="remove" encoding="ISO-8859-1">
      <include name="**/*.html" />
      <include name="**/*.java" />
      <include name="**/*.properties" />
      <include name="**/*.txt" />
      <include name="**/*.xml" />
    </fixcrlf>
    <delete file="${build.dir}/${final.name}.tar.gz" quiet="true"/>
    <tar tarfile="${build.dir}/${final.name}.tar.gz" basedir="${dist.root}"
         includes="**/${final.name}/**" longfile="gnu" compression="gzip" />
    <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="md5" property="checksum.tgz.md5"/>
    <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="sha1" property="checksum.tgz.sha1"/>
    <echo message="${checksum.tgz.md5} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.md5" />
    <echo message="${checksum.tgz.sha1} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.sha1" />
  </target>

  
  <!-- Packages the distribution with ZIP and TAR-GZIP                    -->
  
  <target name="package"
          depends="package-zip,package-tgz"
          description="Generates the distribution files">
  </target>
  
  
  <!-- Cleans up the build directory. Leave Libs unharmed to avoid re-download -->
  
  <target name="clean" 
          description="Cleans all generated files except downloaded libs">
    <delete includeEmptyDirs="true" quiet="true">
      <fileset dir="${build.dir}" defaultexcludes="no">
        <exclude name="lib/**" />
        <exclude name="test-lib/**" />
      </fileset>
      <fileset dir="${ant.build.dir}" defaultexcludes="no">
        <include name="velocity.log" />
      </fileset>
    </delete>
  </target>

  <!-- Really cleans up the build directory                                -->
  <target name="real-clean" 
          description="Cleans all generated files">
    <delete includeEmptyDirs="true" quiet="true" dir="${build.dir}" />
  </target>

  <!-- Make HTML version of the documentation                         -->

  <target name="docs" depends="build-prepare,jar"
          description="Generates the HTML documentation">
    <taskdef name="anakia"
             classname="org.apache.anakia.AnakiaTask"
             classpathref="run.classpath"/>
    <echo>
  #######################################################
  #
  #  Now using Anakia to transform the XML documentation
  #  to HTML.
  #######################################################
    </echo>
    <anakia basedir="${xdocs.dir}/docs" destdir="${build.docs}"
         extension=".html" style="site.vsl"
         projectFile="../stylesheets/project.xml"
         includes="**/*.xml"
         lastModifiedCheck="true"
         templatePath="${xdocs.dir}/stylesheets">
    </anakia>
    <copy todir="${build.docs}/images" filtering="no">
        <fileset dir="${xdocs.dir}/images">
            <include name="**/*.gif"/>
            <include name="**/*.jpeg"/>
            <include name="**/*.jpg"/>
            <include name="**/*.png"/>
        </fileset>
    </copy>
    <copy todir="${build.docs}" filtering="no">
        <fileset dir="${xdocs.dir}">
            <include name="**/*.css"/>
            <include name="**/.htaccess"/>
        </fileset>
    </copy>
  </target>

  
  <!-- Cleans up the docs directory                                       -->
  
  <target name="docs-clean">
    <delete dir="${build.docs}" quiet="true"/>
  </target>

  
  <!-- JUnit Tests                                                         -->
  
  <target name="test-clean">
    <delete dir="${build.test.dest}" quiet="true"/>
    <delete dir="${build.test}" quiet="true"/>
    <delete dir="${build.test.reports}" quiet="true"/>
  </target>

  <target name="test"
          depends="build-prepare,compile-test,test-anakia"/>

  <target name="test-anakia">
    <echo message="Running Anakia tests..."/>
    <taskdef name="anakia" classname="org.apache.anakia.AnakiaTask"
             classpathref="test.classpath"/>
    <!-- run twice - once with custom context and once without -->
    <anakia basedir="${test.dir}/anakia/xdocs"
            destdir="${build.test}/anakia"
        extension=".html" style="./site_contexts.vsl"
        projectFile="./stylesheets/project.xml"
        excludes="**/stylesheets/**"
        includes="**/*.xml"
        templatePath="${test.dir}/anakia/xdocs/stylesheets"
        lastModifiedCheck="false">
    </anakia>
    <anakia basedir="${test.dir}/anakia/xdocs"
            destdir="${build.test}/anakia"
        extension=".context.html" style="./site_contexts.vsl"
        projectFile="./stylesheets/project.xml"
        excludes="**/stylesheets/**"
        includes="**/*.xml"
        templatePath="${test.dir}/anakia/xdocs/stylesheets"
        lastModifiedCheck="false">
        <context name="customContext" file="./stylesheets/customContext.xml"/>
    </anakia>
    <java classname="${test.runner}" fork="yes" dir="${app.dir}" failonerror="${test.haltonerror}"
          classpathref="test.classpath">
      <arg value="org.apache.anakia.AnakiaTestCase"/>
    </java>
  </target>

</project>





Javac with optimize

 
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.    
#
# This file is used by build.xml 
#
# Global defaults
name=          Anakia
project=       anakia
version=       1.0
final.name=    ${project}-${version}
root.package=  org.apache.anakia
# compile switches
debug= on
optimize= on
deprecation= off
ant.build.dir= build
build.dir= ${app.dir}/bin
# The source tree runs through a filter copy task to
# allow substitution of version, date etc. and will
# end up in build.src
build.lib=       ${build.dir}/lib
build.test.lib=  ${build.dir}/test-lib
build.dest=      ${build.dir}/classes
build.test.dest= ${build.dir}/test-classes
build.javadoc=   ${build.dir}/apidocs
build.test=      ${build.dir}/test
build.docs=      ${build.dir}/docs
# Various local pathes in the distribution
src.java.dir=  ${app.dir}/src/java
test.java.dir= ${app.dir}/src/test
test.dir=      ${app.dir}/test
example.dir=   ${app.dir}/examples
xdocs.dir=     ${app.dir}/xdocs
# Running the tests
test.haltonerror= true
test.haltonfailure= true
# Building the distribution
dist.root= ${build.dir}/dist
dist.dir= ${dist.root}/${final.name}
# Set to Sun Javadocs
javadocs.ref.jsdk= http://java.sun.ru/j2se/1.4.2/docs/api/
# for the javadoc
javadoc.packagenames = ${root.package}.*
# attributes for the jar manifest
mf.package = ${root.package}
mf.extension.name = ${project}
mf.specification.title = Anakia is a XML-based text processor
mf.specification.vendor = Apache Software Foundation
mf.implementation.title = ${mf.package}
mf.implementation.vendor.id = org.apache
mf.implementation.vendor = Apache Software Foundation
mf.implementation.version = ${version}

# #######################################################################
#
# Downloading jars from ibiblio repository
#
# #######################################################################
# The default behaviour is to download dependency jars only when
# they are not already present.
# Set skip.jar.loading to true to never download any dependency jar,
# or force.jar.loading to true to always download all dependency jars.
skip.jar.loading= false
force.jar.loading= false
#
# Settings for the proxy to use for download. Change this if you must
# use a proxy from your host. If the proxy.host property is unset, no
# proxy is used.
proxy.host=
proxy.port= 80
#
# We download directly from the ibiblio maven repository
repo.url= http://www.ibiblio.org/maven
#
# Jars to be downloaded
jar.antlr.version= 2.7.5
jar.rumons-collections.version= 3.1
jar.rumons-lang.version= 2.1
jar.jdom.version= 1.0
jar.werken-xpath.version= 0.9.4
jar.junit.version= 3.8.1
jar.velocity.version= 1.5

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
   http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.    
-->
<!-- Build file for project -->
<!-- This project has its basedir set to the root directory   -->
<!-- of the project distribution. This is necessary so that   -->
<!-- all the code that uses relative directory references     -->
<!-- (like the tests) can be run in the same way when using   -->
<!-- the ant based build and the maven based build.           -->
<!-- *** DO NOT CHANGE THIS SETTING LIGHTLY! ***              -->
<project name="Anakia" default="world" basedir="..">
  <path id="basedir-os">
    <pathelement location="${basedir}" />
  </path>
  <!-- This is the relative base dir. This must be the root of the   -->
  <!-- distribution. All relative pathes are prefixed with      -->
  <!-- app.dir                                                  -->
  <pathconvert property="app.dir" refid="basedir-os" targetos="unix"/>
  <!-- Give user a chance to override without editing this file
       (and without typing -D each time it compiles it -->
  <property file="${user.home}/.ant.properties" />
  <property file="${user.home}/build.properties" />
  <property file=".ant.properties" />
  <!-- This file contains all the defaults for the build  -->
  <property file="build/build.properties" />

  <property name="test.runner" value="junit.textui.TestRunner"/>
  <target name="world" depends="jar,test,javadocs,docs,env"
          description="Build the project jar and documentation"/>
  
  <!-- prints the environment                                              -->
  
  <target name="env" description="Prints build parameters">
    <echo>
  Global settings:
    java.home = ${java.home}
    user.home = ${user.home}
    java.class.path = ${java.class.path}
  Project settings:
    Version:     ${version}
    Debug:       ${debug}
    Optimize:    ${optimize}
    Deprecation: ${deprecation}
  Target settings (relative to build tree root):
    Classes:      ${build.dest}
    API Docs:     ${build.javadoc}
    Docs:         ${build.docs}
    </echo>
  </target>
  
  <!-- Prepares the build directory                                        -->
  
  <target name="prepare" depends="basic-prepare"/>
  
  <!-- sets up the build trees for sources and tests                       -->
  
  <target name="basic-prepare">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.test.dest}"/>
  </target>
  
  <!-- sets up the build environment (classpath and libs)                  -->
  
  <target name="build-prepare" depends="basic-prepare">
    <ant antfile="${ant.build.dir}/download.xml" target="build-download" />
    <!-- Build classpath -->
    <path id="build.classpath">
      <fileset dir="${build.lib}">
        <include name="**/*.jar"/>
      </fileset>
    </path>
    <!-- Test classpath, contains dependencies needed only for Testing -->
    <path id="test.classpath">
        <fileset dir="${build.test.lib}">
          <include name="**/*.jar"/>
        </fileset>
        <fileset dir="${build.lib}">
          <include name="**/*.jar"/>
        </fileset>
        <pathelement location="${build.dest}" />
        <pathelement location="${build.test.dest}" />
    </path>
    <path id="run.classpath">
      <path refid="build.classpath"/>
      <pathelement location="${build.dir}/${final.name}.jar"/>
    </path>
  </target>
  
  <!-- Compiles the source tree and the tests                              -->
  
  <target name="compile" depends="compile-src,compile-test"/>
  <target name="compile-src" depends="build-prepare"
          description="Compiles the source">
    <javac srcdir="${src.java.dir}"
      destdir="${build.dest}"
      encoding="UTF-8"
      debug="${debug}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      classpathref="build.classpath"/>
    <copy todir="${build.dest}" filtering="yes">
      <fileset dir="${src.java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>
  </target>
  <target name="compile-test" depends="build-prepare,compile-src"
          description="Compiles the test classes">
    <javac srcdir="${test.java.dir}"
      destdir="${build.test.dest}"
      encoding="UTF-8"
      debug="${debug}"
      deprecation="${deprecation}"
      optimize="${optimize}">
      <!-- Don"t use the run classpath, build using the exploded class tree -->
      <classpath>
        <path refid="build.classpath"/>
        <path refid="test.classpath" />
        <pathelement location="${build.dest}"/>
      </classpath>
    </javac>
    <copy todir="${build.test.dest}" filtering="yes">
      <fileset dir="${test.java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>
  </target>

  
  <!-- Compiles the source directory and creates a .jar file               -->
  
  <target name="jar" depends="compile-src"
          description="Builds the Jar file">
    <property name="jarname" value="${final.name}" />
    <jar jarfile="${build.dir}/${jarname}.jar">
      <metainf dir="${app.dir}">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </metainf>
      <fileset dir="${build.dest}"/>
      <manifest>
        <attribute name="Created-By" value="Apache Ant"/>
        <attribute name="Build-Jdk" value="${java.version}"/>
        <attribute name="Package" value="${mf.package}"/>
        <attribute name="Extension-Name" value="${mf.extension.name}"/>
        <attribute name="Specification-Title" value="${mf.specification.title}" />
        <attribute name="Specification-Vendor" value="${mf.specification.vendor}"/>
        <attribute name="Implementation-Title" value="${mf.implementation.title}"/>
        <attribute name="Implementation-Vendor-Id" value="${mf.implementation.vendor.id}"/>
        <attribute name="Implementation-Vendor" value="${mf.implementation.vendor}"/>
        <attribute name="Implementation-Version" value="${mf.implementation.version}"/>
      </manifest>
    </jar>
    <checksum file="${build.dir}/${jarname}.jar" algorithm="md5" property="checksum.jar.md5"/>
    <checksum file="${build.dir}/${jarname}.jar" algorithm="sha1" property="checksum.jar.sha1"/>
    <echo message="${checksum.jar.md5} *${jarname}.jar" file="${build.dir}/${jarname}.jar.md5" />
    <echo message="${checksum.jar.sha1} *${jarname}.jar" file="${build.dir}/${jarname}.jar.sha1" />
  </target>
  
  <!-- jars the source                                                    -->
  
  <target name="jar-src"
          depends="prepare"
          description="Builds the Source Jar File">
    <jar jarfile="${build.dir}/${final.name}-src.jar">
      <metainf dir="${app.dir}">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </metainf>
      <fileset dir="${src.java.dir}"/>
      <manifest>
        <attribute name="Created-By" value="Apache Ant"/>
        <attribute name="Specification-Title" value="${mf.specification.title}" />
        <attribute name="Specification-Vendor" value="${mf.specification.vendor}"/>
        <attribute name="Implementation-Title" value="${mf.implementation.title}"/>
        <attribute name="Implementation-Vendor-Id" value="${mf.implementation.vendor.id}"/>
        <attribute name="Implementation-Vendor" value="${mf.implementation.vendor}"/>
        <attribute name="Implementation-Version" value="${mf.implementation.version}"/>
      </manifest>
    </jar>
    <checksum file="${build.dir}/${final.name}-src.jar" algorithm="md5" property="checksum.jar-src.md5"/>
    <checksum file="${build.dir}/${final.name}-src.jar" algorithm="sha1" property="checksum.jar-src.sha1"/>
    <echo message="${checksum.jar-src.md5} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.md5" />
    <echo message="${checksum.jar-src.sha1} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.sha1" />
  </target>
  
  <!-- Creates the API documentation                                       -->
  
  <target name="javadocs" depends="build-prepare"
          description="Creates the Javadoc API documentation">
    <mkdir dir="${build.javadoc}"/>
    <javadoc sourcepath="${src.java.dir}"
             packagenames="${javadoc.packagenames}"
             destdir="${build.javadoc}"
             author="true"
             private="false"
             version="true"
             use="true"
             windowtitle="${name} ${version} API"
             doctitle="${name} ${version} API"
             encoding="UTF-8"
             docencoding="UTF-8"
             bottom="Copyright &#169; 2000-${build.year} &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache Software Foundation&lt;/a&gt;. All Rights Reserved."
             classpathref="build.classpath">
      <link href="${javadocs.ref.jsdk}"/>
      <link href="http://www.jdom.org/docs/apidocs"/>
      <link href="http://logging.apache.org/log4j/docs/api"/>
      <link href="http://excalibur.apache.org/apidocs"/>
      <link href="http://tomcat.apache.org/tomcat-4.1-doc/servletapi"/>
      <link href="http://jakarta.apache.org/oro/api"/>
      <link href="http://jakarta.apache.org/commons/lang/api-release"/>
      <link href="http://jakarta.apache.org/commons/collections/api-release"/>
    </javadoc>
  </target>
  <target name="javadocs-clean">
    <delete dir="${build.javadoc}" quiet="true"/>
  </target>
  
  <!-- Package                                                             -->
  
  <target name="build-package-tree" depends="clean,jar,docs,javadocs">

    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${dist.dir}/src/java"/>
    <copy todir="${dist.dir}/src/java/">
      <fileset dir="${src.java.dir}" />
    </copy>
    <copy todir="${dist.dir}/src/test/">
      <fileset dir="${test.java.dir}" />
    </copy>
    <copy todir="${dist.dir}/lib">
      <fileset dir="${build.lib}" />
    </copy>
    <copy todir="${dist.dir}/lib/test">
      <fileset dir="${build.test.lib}" />
    </copy>
    <copy todir="${dist.dir}/build">
      <fileset dir="${app.dir}/build">
        <include name="**"/>
        <exclude name="velocity.log"/>
      </fileset>
    </copy>
    <!-- Copy docs, exclude API docs -->
    <copy todir="${dist.dir}/docs">
      <fileset dir="${build.docs}">
        <include name="**"/>
        <exclude name="docs/api/**"/>
      </fileset>
    </copy>
    <!-- Add freshly built Java docs -->
    <copy todir="${dist.dir}/docs/api">
      <fileset dir="${build.javadoc}">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}/test">
      <fileset dir="${app.dir}/test">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}/xdocs">
      <fileset dir="${xdocs.dir}">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}">
      <fileset dir="${app.dir}">
        <include name="LICENSE" />
        <include name="NOTICE" />
        <include name="README.txt" />
        <include name="pom.xml" />
      </fileset>
    </copy>
    <copy
      file="${build.dir}/${final.name}.jar"
      tofile="${dist.dir}/${final.name}.jar"
    />
  </target>
  
  <!-- Packages the distribution with ZIP                                 -->
  
  <target name="package-zip"
          depends="build-package-tree">
    <!-- .zip built for Windows -->
    <fixcrlf srcdir="${dist.dir}" eol="crlf" eof="asis" encoding="ISO-8859-1">
      <include name="**/*.html" />
      <include name="**/*.java" />
      <include name="**/*.properties" />
      <include name="**/*.txt" />
      <include name="**/*.xml" />
    </fixcrlf>
    <delete file="${build.dir}/${final.name}.zip" quiet="true"/>
    <zip zipfile="${build.dir}/${final.name}.zip" basedir="${dist.root}"
         includes="**/${final.name}/**"/>
    <checksum file="${build.dir}/${final.name}.zip" algorithm="md5" property="checksum.zip.md5"/>
    <checksum file="${build.dir}/${final.name}.zip" algorithm="sha1" property="checksum.zip.sha1"/>
    <echo message="${checksum.zip.md5} *${final.name}.zip" file="${build.dir}/${final.name}.zip.md5" />
    <echo message="${checksum.zip.sha1} *${final.name}.zip" file="${build.dir}/${final.name}.zip.sha1" />
  </target>
  
  <!-- Packages the distribution with TAR-GZIP                            -->
  
  <target name="package-tgz"
          depends="build-package-tree">
    <!-- .tar.gz built for Unix -->
    <fixcrlf srcdir="${dist.dir}" eol="lf" eof="remove" encoding="ISO-8859-1">
      <include name="**/*.html" />
      <include name="**/*.java" />
      <include name="**/*.properties" />
      <include name="**/*.txt" />
      <include name="**/*.xml" />
    </fixcrlf>
    <delete file="${build.dir}/${final.name}.tar.gz" quiet="true"/>
    <tar tarfile="${build.dir}/${final.name}.tar.gz" basedir="${dist.root}"
         includes="**/${final.name}/**" longfile="gnu" compression="gzip" />
    <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="md5" property="checksum.tgz.md5"/>
    <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="sha1" property="checksum.tgz.sha1"/>
    <echo message="${checksum.tgz.md5} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.md5" />
    <echo message="${checksum.tgz.sha1} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.sha1" />
  </target>

  
  <!-- Packages the distribution with ZIP and TAR-GZIP                    -->
  
  <target name="package"
          depends="package-zip,package-tgz"
          description="Generates the distribution files">
  </target>
  
  
  <!-- Cleans up the build directory. Leave Libs unharmed to avoid re-download -->
  
  <target name="clean" 
          description="Cleans all generated files except downloaded libs">
    <delete includeEmptyDirs="true" quiet="true">
      <fileset dir="${build.dir}" defaultexcludes="no">
        <exclude name="lib/**" />
        <exclude name="test-lib/**" />
      </fileset>
      <fileset dir="${ant.build.dir}" defaultexcludes="no">
        <include name="velocity.log" />
      </fileset>
    </delete>
  </target>
  
  <!-- Really cleans up the build directory                                -->
  
  <target name="real-clean" 
          description="Cleans all generated files">
    <delete includeEmptyDirs="true" quiet="true" dir="${build.dir}" />
  </target>
  
  <!-- Make HTML version of the documentation                         -->
  
  <target name="docs" depends="build-prepare,jar"
          description="Generates the HTML documentation">
    <taskdef name="anakia"
             classname="org.apache.anakia.AnakiaTask"
             classpathref="run.classpath"/>
    <echo>
  #######################################################
  #
  #  Now using Anakia to transform the XML documentation
  #  to HTML.
  #######################################################
    </echo>
    <anakia basedir="${xdocs.dir}/docs" destdir="${build.docs}"
         extension=".html" style="site.vsl"
         projectFile="../stylesheets/project.xml"
         includes="**/*.xml"
         lastModifiedCheck="true"
         templatePath="${xdocs.dir}/stylesheets">
    </anakia>
    <copy todir="${build.docs}/images" filtering="no">
        <fileset dir="${xdocs.dir}/images">
            <include name="**/*.gif"/>
            <include name="**/*.jpeg"/>
            <include name="**/*.jpg"/>
            <include name="**/*.png"/>
        </fileset>
    </copy>
    <copy todir="${build.docs}" filtering="no">
        <fileset dir="${xdocs.dir}">
            <include name="**/*.css"/>
            <include name="**/.htaccess"/>
        </fileset>
    </copy>
  </target>

  
  <!-- Cleans up the docs directory                                       -->
  
  <target name="docs-clean">
    <delete dir="${build.docs}" quiet="true"/>
  </target>

  
  <!-- JUnit Tests                                                         -->
  
  <target name="test-clean">
    <delete dir="${build.test.dest}" quiet="true"/>
    <delete dir="${build.test}" quiet="true"/>
    <delete dir="${build.test.reports}" quiet="true"/>
  </target>

  <target name="test"
          depends="build-prepare,compile-test,test-anakia"/>

  <target name="test-anakia">
    <echo message="Running Anakia tests..."/>
    <taskdef name="anakia" classname="org.apache.anakia.AnakiaTask"
             classpathref="test.classpath"/>
    <!-- run twice - once with custom context and once without -->
    <anakia basedir="${test.dir}/anakia/xdocs"
            destdir="${build.test}/anakia"
        extension=".html" style="./site_contexts.vsl"
        projectFile="./stylesheets/project.xml"
        excludes="**/stylesheets/**"
        includes="**/*.xml"
        templatePath="${test.dir}/anakia/xdocs/stylesheets"
        lastModifiedCheck="false">
    </anakia>
    <anakia basedir="${test.dir}/anakia/xdocs"
            destdir="${build.test}/anakia"
        extension=".context.html" style="./site_contexts.vsl"
        projectFile="./stylesheets/project.xml"
        excludes="**/stylesheets/**"
        includes="**/*.xml"
        templatePath="${test.dir}/anakia/xdocs/stylesheets"
        lastModifiedCheck="false">
        <context name="customContext" file="./stylesheets/customContext.xml"/>
    </anakia>
    <java classname="${test.runner}" fork="yes" dir="${app.dir}" failonerror="${test.haltonerror}"
          classpathref="test.classpath">
      <arg value="org.apache.anakia.AnakiaTestCase"/>
    </java>
  </target>

</project>





Set debug and optimize for javac

 
<?xml version="1.0"?>
<project name="yourName" default="junitgui" basedir=".">
  <property name="junitJar" value="\junit3.8.1\junit.jar" />
  <property name="src.dir" value="${basedir}\src" />
  <property name="build.dir" value="${basedir}\classes" />
  <path id="classpath">
    <pathelement location="${junitJar}" />
    <pathelement location="${build.dir}" />
  </path>
  <target name="init">
    <mkdir dir="${build.dir}" />
  </target>
  <target name="build" depends="init" description="build all">
    <javac
        srcdir="${src.dir}" destdir="${build.dir}"
        source="1.5" 
        deprecation="on" debug="on" optimize="off" includes="**">
      <classpath refid="classpath" />
    </javac>
  </target>
  <target name="junitgui" depends="build" description="run junitgui">
    <java classname="junit.awtui.TestRunner" fork="yes">
      <arg value="sis.AllTests" />
      <classpath refid="classpath" />
    </java>
  </target>
   <target name="clean">  
    <delete dir="${build.dir}" />
  </target>
   <target name="rebuildAll" depends="clean,build" description="rebuild all"/>
</project>





Set debuglevel for javac

 
//COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 
<project name="ajax4jsf" default="distribute">
  <property name="commonLibs.dir" value="${basedir}/commonLibs"></property>
  
  <property name="distrib.dir" value="${basedir}/distribution"/>
  <property name="work.dir" value="${basedir}/build"/>
  
  <property name="src.root.dir" value="${basedir}/src"></property>
  
  <property name="test.src.dir" value="${src.root.dir}/testCase"></property>
  <property name="framework.src.dir" value="${src.root.dir}/framework"></property>
  <property name="framework.java.src.dir" value="${framework.src.dir}/java"></property>
  <property name="framework.js.src.dir" value="${framework.src.dir}/JavaScript"></property>
  <property name="framework.generate.src.dir" value="${framework.src.dir}/generate"></property>
  <property name="framework.build.dir" value="${work.dir}/framework"></property>
  <property name="cdk.src.dir" value="${src.root.dir}/cdk"></property>
  <property name="cdk.build.dir" value="${work.dir}/cdk"></property>
    <property name="test.src.dir" value="${src.root.dir}/test"></property>
    <property name="test.build.dir" value="${work.dir}/test"></property>
  <property name="doc.root.dir" value="${distrib.dir}/docs"></property>
  <property name="tlddoc.dir" value="${doc.root.dir}/tldDoc"></property>
  <property name="javadoc.dir" value="${doc.root.dir}/javaAPI"></property>
  <property name="tlddoc.jar" value="${commonLibs.dir}/tlddoc.jar"></property>
  
  <property name="framework-distribution-name" value="ajax4jsf"></property>
  <property name="cdk-distribution-name" value="ajax4jsf-cdk" />
    <property name="test-distribution-name" value="ajax4jsf-test" />
  
  <property name="generated-source.dir" value="${work.dir}/gen-src"></property>
  
  <fileset id="commonLibs" dir="${commonLibs.dir}">
    <include name="*.jar"/>
  </fileset>
  
  <path id="class-path">
    <fileset refid="commonLibs"></fileset>
  </path>
  <target name="prepare">
    <mkdir dir="${distrib.dir}"/>
    <mkdir dir="${work.dir}"/>
  </target>
  
  <target name="generate-framework" depends="compile-framework,compile-cdk">
    <ant antfile="${framework.generate.src.dir}/build.xml" inheritall="true" dir="${basedir}" target="xml-merge">
    </ant>
  </target>

  <target name="prepare-framework">
    <mkdir dir="${framework.build.dir}" />
  </target>
  <target name="prepare-cdk">
    <mkdir dir="${cdk.build.dir}" />
  </target>
    <target name="prepare-test">
        <mkdir dir="${test.build.dir}" />
    </target>
  
  <target name="compile-framework" depends="prepare-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
            failonerror="false"         
      debuglevel="lines,vars,source">
      <classpath refid="class-path"></classpath>
      <src path="${framework.src.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${framework.java.src.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*faces-config.xml"/>
      </fileset>
    </copy>
  </target>
  <target name="compile-cdk" depends="prepare-cdk">
    <javac 
      destdir="${cdk.build.dir}"
      compiler="javac1.5" 
      source="1.5" 
      target="1.5" 
      debug="true" 
      debuglevel="lines,vars,source">
        <classpath refid="class-path"></classpath>
      <src path="${cdk.src.dir}"></src>
    </javac>
    <copy todir="${cdk.build.dir}/META-INF">
      <fileset dir="${cdk.src.dir}/META-INF">
        <include name="**/*.*"/>
      </fileset>        
    </copy>    
  </target>
  
    <target name="compile-test" depends="prepare-test">
        <javac 
            destdir="${test.build.dir}"
            compiler="javac1.4" 
            source="1.4" 
            target="1.4" 
            debug="true" 
            debuglevel="lines,vars,source"
            includes="org/ajax4jsf/tests/*.*" >
                <classpath refid="class-path"></classpath>
            <classpath path="${framework.build.dir}"></classpath>   
            <src path="${test.src.dir}">
            </src>
        </javac>
        <copy todir="${test.build.dir}/META-INF">
            <fileset dir="${test.src.dir}/META-INF">
                <include name="**/*.*"/>
            </fileset>              
        </copy>     
        <copy todir="${test.build.dir}/WEB-INF">
            <fileset dir="${test.src.dir}/WEB-INF">
                <include name="**/*.*"/>
            </fileset>              
        </copy>     
    </target>
    <target name="compile-framework-phase2" depends="generate-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
      debuglevel="lines,vars,source">
      <classpath>
        <path>
        <path refid="class-path"></path>
        <pathelement path="${framework.build.dir}"/>
        </path>
      </classpath>
      <src path="${generated-source.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${generated-source.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*-faces-config.xml"/>
      </fileset>
    </copy>
  </target>
  
  <target name="assemble-javascripts" depends="prepare-framework">
    <ant antfile="${framework.js.src.dir}/build.xml" dir="${framework.js.src.dir}">
      <property name="target-dir" value="${framework.build.dir}"></property>
    </ant>
  </target>
  
  <target name="build-framework" depends="compile-framework,assemble-javascripts,compile-framework-phase2">
  </target>
  <target name="build-cdk" depends="compile-cdk">
  </target>
  
    <target name="build-test" depends="compile-test">
    </target>
        <target name="prepare-distribution-dir">
    <mkdir dir="${distrib.dir}/lib"/>
  </target>
  
  <target name="package-framework" depends="build-framework, prepare-distribution-dir">
    <jar destfile="${distrib.dir}/lib/${framework-distribution-name}.jar">
      <fileset dir="${framework.build.dir}">
        <include name="**/*.*"/>
      </fileset>
    </jar>
  </target>
  
  <target name="package-cdk" depends="prepare-distribution-dir,build-cdk">
    <jar destfile="${distrib.dir}/lib/${cdk-distribution-name}.jar">
      <fileset dir="${cdk.build.dir}">
        <include name="**/*.*"/>
      </fileset>
    </jar>
  </target>
    <target name="package-test" depends="prepare-distribution-dir,build-test">
        <jar destfile="${distrib.dir}/lib/${test-distribution-name}.jar">
            <fileset dir="${test.build.dir}">
                <include name="**/*.*"/>
            </fileset>
        </jar>
    </target>
  <target name="prepare-docs">
    <mkdir dir="${doc.root.dir}"/>
  </target>
  
  <target name="docs" depends="prepare-docs, javadoc, tlddoc, copy-doc">
    
  </target>
  
  <target name="copy-doc" depends="prepare-docs">
    <copy todir="${doc.root.dir}" failonerror="false">
      <fileset dir="${basedir}/doc">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="javadoc">
    <mkdir dir="${javadoc.dir}"/>
    <javadoc packagenames="org.*" destdir="${javadoc.dir}">
      <sourcepath>
        <pathelement path="${framework.java.src.dir}"/>
      </sourcepath>
      <classpath refid="class-path"></classpath>
    </javadoc>
  </target>
  
  <target name="tlddoc">
    <mkdir dir="${tlddoc.dir}"/>
    <echo message="${tlddoc.jar}"></echo>
    <apply executable="java" parallel="true" verbose="true">
      <!-- dir="${tlddoc.dir}">-->
      <arg line="-jar ${tlddoc.jar}"/>
      <arg line="-doctitle "AJAX4JSF""/>
      <!--arg line="-xslt ${tlddocxsl.dir}"/-->
      <arg line="-d ${tlddoc.dir}"/>
      <fileset dir="${framework.build.dir}/META-INF" includes="**.tld"/>
    </apply>
  </target>
  
  <target name="copy-dependencies" depends="prepare-distribution-dir">
    <copy todir="${distrib.dir}/lib">
      <fileset dir="${commonLibs.dir}">
        <include name="oscache*.jar"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-src">
    <mkdir dir="${distrib.dir}/src"/>
    <copy todir="${distrib.dir}/src">
      <fileset dir="${framework.src.dir}">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-demo">
    <mkdir dir="${distrib.dir}/demo"/>
    <copy todir="${distrib.dir}/demo" failonerror="false">
      <fileset dir="${basedir}/demo">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-txt">
    <copy todir="${distrib.dir}">
      <fileset dir="${basedir}">
        <include name="*.txt"/>
        <include name="*.TXT"/>
      </fileset>
    </copy>
  </target>
  
  <target name="build-test-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
      debuglevel="lines,vars,source">
      <classpath refid="class-path"></classpath>
      <src path="${test.src.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${test.src.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*"/>
        <exclude name="WEB-INF/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="distribute" depends="clean,build-framework,package-framework, copy-dependencies, docs, copy-src, copy-txt, copy-demo, package-cdk, package-test">
    <!--delete dir="${work.dir}"></delete-->
    <delete file="${basedir}/velocity.log" failonerror="false" verbose="true"></delete>
  </target>
  
  <target name="clean">
    <delete dir="${work.dir}"></delete>
    <delete includeemptydirs="true" failonerror="false">
      <fileset dir="${distrib.dir}">
        <include name="**/*"/>
      </fileset>
    </delete>
  </target>
</project>





Set failonerror for javac

 
//COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 
<project name="ajax4jsf" default="distribute">
  <property name="commonLibs.dir" value="${basedir}/commonLibs"></property>
  
  <property name="distrib.dir" value="${basedir}/distribution"/>
  <property name="work.dir" value="${basedir}/build"/>
  
  <property name="src.root.dir" value="${basedir}/src"></property>
  
  <property name="test.src.dir" value="${src.root.dir}/testCase"></property>
  <property name="framework.src.dir" value="${src.root.dir}/framework"></property>
  <property name="framework.java.src.dir" value="${framework.src.dir}/java"></property>
  <property name="framework.js.src.dir" value="${framework.src.dir}/JavaScript"></property>
  <property name="framework.generate.src.dir" value="${framework.src.dir}/generate"></property>
  <property name="framework.build.dir" value="${work.dir}/framework"></property>
  <property name="cdk.src.dir" value="${src.root.dir}/cdk"></property>
  <property name="cdk.build.dir" value="${work.dir}/cdk"></property>
    <property name="test.src.dir" value="${src.root.dir}/test"></property>
    <property name="test.build.dir" value="${work.dir}/test"></property>
  <property name="doc.root.dir" value="${distrib.dir}/docs"></property>
  <property name="tlddoc.dir" value="${doc.root.dir}/tldDoc"></property>
  <property name="javadoc.dir" value="${doc.root.dir}/javaAPI"></property>
  <property name="tlddoc.jar" value="${commonLibs.dir}/tlddoc.jar"></property>
  
  <property name="framework-distribution-name" value="ajax4jsf"></property>
  <property name="cdk-distribution-name" value="ajax4jsf-cdk" />
    <property name="test-distribution-name" value="ajax4jsf-test" />
  
  <property name="generated-source.dir" value="${work.dir}/gen-src"></property>
  
  <fileset id="commonLibs" dir="${commonLibs.dir}">
    <include name="*.jar"/>
  </fileset>
  
  <path id="class-path">
    <fileset refid="commonLibs"></fileset>
  </path>
  <target name="prepare">
    <mkdir dir="${distrib.dir}"/>
    <mkdir dir="${work.dir}"/>
  </target>
  
  <target name="generate-framework" depends="compile-framework,compile-cdk">
    <ant antfile="${framework.generate.src.dir}/build.xml" inheritall="true" dir="${basedir}" target="xml-merge">
    </ant>
  </target>

  <target name="prepare-framework">
    <mkdir dir="${framework.build.dir}" />
  </target>
  <target name="prepare-cdk">
    <mkdir dir="${cdk.build.dir}" />
  </target>
    <target name="prepare-test">
        <mkdir dir="${test.build.dir}" />
    </target>
  
  <target name="compile-framework" depends="prepare-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
            failonerror="false"         
      debuglevel="lines,vars,source">
      <classpath refid="class-path"></classpath>
      <src path="${framework.src.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${framework.java.src.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*faces-config.xml"/>
      </fileset>
    </copy>
  </target>
  <target name="compile-cdk" depends="prepare-cdk">
    <javac 
      destdir="${cdk.build.dir}"
      compiler="javac1.5" 
      source="1.5" 
      target="1.5" 
      debug="true" 
      debuglevel="lines,vars,source">
        <classpath refid="class-path"></classpath>
      <src path="${cdk.src.dir}"></src>
    </javac>
    <copy todir="${cdk.build.dir}/META-INF">
      <fileset dir="${cdk.src.dir}/META-INF">
        <include name="**/*.*"/>
      </fileset>        
    </copy>    
  </target>
  
    <target name="compile-test" depends="prepare-test">
        <javac 
            destdir="${test.build.dir}"
            compiler="javac1.4" 
            source="1.4" 
            target="1.4" 
            debug="true" 
            debuglevel="lines,vars,source"
            includes="org/ajax4jsf/tests/*.*" >
                <classpath refid="class-path"></classpath>
            <classpath path="${framework.build.dir}"></classpath>   
            <src path="${test.src.dir}">
            </src>
        </javac>
        <copy todir="${test.build.dir}/META-INF">
            <fileset dir="${test.src.dir}/META-INF">
                <include name="**/*.*"/>
            </fileset>              
        </copy>     
        <copy todir="${test.build.dir}/WEB-INF">
            <fileset dir="${test.src.dir}/WEB-INF">
                <include name="**/*.*"/>
            </fileset>              
        </copy>     
    </target>
    <target name="compile-framework-phase2" depends="generate-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
      debuglevel="lines,vars,source">
      <classpath>
        <path>
        <path refid="class-path"></path>
        <pathelement path="${framework.build.dir}"/>
        </path>
      </classpath>
      <src path="${generated-source.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${generated-source.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*-faces-config.xml"/>
      </fileset>
    </copy>
  </target>
  
  <target name="assemble-javascripts" depends="prepare-framework">
    <ant antfile="${framework.js.src.dir}/build.xml" dir="${framework.js.src.dir}">
      <property name="target-dir" value="${framework.build.dir}"></property>
    </ant>
  </target>
  
  <target name="build-framework" depends="compile-framework,assemble-javascripts,compile-framework-phase2">
  </target>
  <target name="build-cdk" depends="compile-cdk">
  </target>
  
    <target name="build-test" depends="compile-test">
    </target>
        <target name="prepare-distribution-dir">
    <mkdir dir="${distrib.dir}/lib"/>
  </target>
  
  <target name="package-framework" depends="build-framework, prepare-distribution-dir">
    <jar destfile="${distrib.dir}/lib/${framework-distribution-name}.jar">
      <fileset dir="${framework.build.dir}">
        <include name="**/*.*"/>
      </fileset>
    </jar>
  </target>
  
  <target name="package-cdk" depends="prepare-distribution-dir,build-cdk">
    <jar destfile="${distrib.dir}/lib/${cdk-distribution-name}.jar">
      <fileset dir="${cdk.build.dir}">
        <include name="**/*.*"/>
      </fileset>
    </jar>
  </target>
    <target name="package-test" depends="prepare-distribution-dir,build-test">
        <jar destfile="${distrib.dir}/lib/${test-distribution-name}.jar">
            <fileset dir="${test.build.dir}">
                <include name="**/*.*"/>
            </fileset>
        </jar>
    </target>
  <target name="prepare-docs">
    <mkdir dir="${doc.root.dir}"/>
  </target>
  
  <target name="docs" depends="prepare-docs, javadoc, tlddoc, copy-doc">
    
  </target>
  
  <target name="copy-doc" depends="prepare-docs">
    <copy todir="${doc.root.dir}" failonerror="false">
      <fileset dir="${basedir}/doc">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="javadoc">
    <mkdir dir="${javadoc.dir}"/>
    <javadoc packagenames="org.*" destdir="${javadoc.dir}">
      <sourcepath>
        <pathelement path="${framework.java.src.dir}"/>
      </sourcepath>
      <classpath refid="class-path"></classpath>
    </javadoc>
  </target>
  
  <target name="tlddoc">
    <mkdir dir="${tlddoc.dir}"/>
    <echo message="${tlddoc.jar}"></echo>
    <apply executable="java" parallel="true" verbose="true">
      <!-- dir="${tlddoc.dir}">-->
      <arg line="-jar ${tlddoc.jar}"/>
      <arg line="-doctitle "AJAX4JSF""/>
      <!--arg line="-xslt ${tlddocxsl.dir}"/-->
      <arg line="-d ${tlddoc.dir}"/>
      <fileset dir="${framework.build.dir}/META-INF" includes="**.tld"/>
    </apply>
  </target>
  
  <target name="copy-dependencies" depends="prepare-distribution-dir">
    <copy todir="${distrib.dir}/lib">
      <fileset dir="${commonLibs.dir}">
        <include name="oscache*.jar"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-src">
    <mkdir dir="${distrib.dir}/src"/>
    <copy todir="${distrib.dir}/src">
      <fileset dir="${framework.src.dir}">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-demo">
    <mkdir dir="${distrib.dir}/demo"/>
    <copy todir="${distrib.dir}/demo" failonerror="false">
      <fileset dir="${basedir}/demo">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-txt">
    <copy todir="${distrib.dir}">
      <fileset dir="${basedir}">
        <include name="*.txt"/>
        <include name="*.TXT"/>
      </fileset>
    </copy>
  </target>
  
  <target name="build-test-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
      debuglevel="lines,vars,source">
      <classpath refid="class-path"></classpath>
      <src path="${test.src.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${test.src.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*"/>
        <exclude name="WEB-INF/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="distribute" depends="clean,build-framework,package-framework, copy-dependencies, docs, copy-src, copy-txt, copy-demo, package-cdk, package-test">
    <!--delete dir="${work.dir}"></delete-->
    <delete file="${basedir}/velocity.log" failonerror="false" verbose="true"></delete>
  </target>
  
  <target name="clean">
    <delete dir="${work.dir}"></delete>
    <delete includeemptydirs="true" failonerror="false">
      <fileset dir="${distrib.dir}">
        <include name="**/*"/>
      </fileset>
    </delete>
  </target>
</project>





Set link for Javac

 
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.    
#
# This file is used by build.xml 
#
# Global defaults
name=          Anakia
project=       anakia
version=       1.0
final.name=    ${project}-${version}
root.package=  org.apache.anakia
# compile switches
debug= on
optimize= on
deprecation= off
ant.build.dir= build
build.dir= ${app.dir}/bin
# The source tree runs through a filter copy task to
# allow substitution of version, date etc. and will
# end up in build.src
build.lib=       ${build.dir}/lib
build.test.lib=  ${build.dir}/test-lib
build.dest=      ${build.dir}/classes
build.test.dest= ${build.dir}/test-classes
build.javadoc=   ${build.dir}/apidocs
build.test=      ${build.dir}/test
build.docs=      ${build.dir}/docs
# Various local pathes in the distribution
src.java.dir=  ${app.dir}/src/java
test.java.dir= ${app.dir}/src/test
test.dir=      ${app.dir}/test
example.dir=   ${app.dir}/examples
xdocs.dir=     ${app.dir}/xdocs
# Running the tests
test.haltonerror= true
test.haltonfailure= true
# Building the distribution
dist.root= ${build.dir}/dist
dist.dir= ${dist.root}/${final.name}
# Set to Sun Javadocs
javadocs.ref.jsdk= http://java.sun.ru/j2se/1.4.2/docs/api/
# for the javadoc
javadoc.packagenames = ${root.package}.*
# attributes for the jar manifest
mf.package = ${root.package}
mf.extension.name = ${project}
mf.specification.title = Anakia is a XML-based text processor
mf.specification.vendor = Apache Software Foundation
mf.implementation.title = ${mf.package}
mf.implementation.vendor.id = org.apache
mf.implementation.vendor = Apache Software Foundation
mf.implementation.version = ${version}

# #######################################################################
#
# Downloading jars from ibiblio repository
#
# #######################################################################
# The default behaviour is to download dependency jars only when
# they are not already present.
# Set skip.jar.loading to true to never download any dependency jar,
# or force.jar.loading to true to always download all dependency jars.
skip.jar.loading= false
force.jar.loading= false
#
# Settings for the proxy to use for download. Change this if you must
# use a proxy from your host. If the proxy.host property is unset, no
# proxy is used.
proxy.host=
proxy.port= 80
#
# We download directly from the ibiblio maven repository
repo.url= http://www.ibiblio.org/maven
#
# Jars to be downloaded
jar.antlr.version= 2.7.5
jar.rumons-collections.version= 3.1
jar.rumons-lang.version= 2.1
jar.jdom.version= 1.0
jar.werken-xpath.version= 0.9.4
jar.junit.version= 3.8.1
jar.velocity.version= 1.5

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
   http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.    
-->
<!-- Build file for project -->
<!-- This project has its basedir set to the root directory   -->
<!-- of the project distribution. This is necessary so that   -->
<!-- all the code that uses relative directory references     -->
<!-- (like the tests) can be run in the same way when using   -->
<!-- the ant based build and the maven based build.           -->
<!-- *** DO NOT CHANGE THIS SETTING LIGHTLY! ***              -->
<project name="Anakia" default="world" basedir="..">
  <path id="basedir-os">
    <pathelement location="${basedir}" />
  </path>
  <!-- This is the relative base dir. This must be the root of the   -->
  <!-- distribution. All relative pathes are prefixed with      -->
  <!-- app.dir                                                  -->
  <pathconvert property="app.dir" refid="basedir-os" targetos="unix"/>
  <!-- Give user a chance to override without editing this file
       (and without typing -D each time it compiles it -->
  <property file="${user.home}/.ant.properties" />
  <property file="${user.home}/build.properties" />
  <property file=".ant.properties" />
  <!-- This file contains all the defaults for the build  -->
  <property file="build/build.properties" />

  <property name="test.runner" value="junit.textui.TestRunner"/>
  <target name="world" depends="jar,test,javadocs,docs,env"
          description="Build the project jar and documentation"/>
  
  <!-- prints the environment                                              -->
  
  <target name="env" description="Prints build parameters">
    <echo>
  Global settings:
    java.home = ${java.home}
    user.home = ${user.home}
    java.class.path = ${java.class.path}
  Project settings:
    Version:     ${version}
    Debug:       ${debug}
    Optimize:    ${optimize}
    Deprecation: ${deprecation}
  Target settings (relative to build tree root):
    Classes:      ${build.dest}
    API Docs:     ${build.javadoc}
    Docs:         ${build.docs}
    </echo>
  </target>
  
  <!-- Prepares the build directory                                        -->
  
  <target name="prepare" depends="basic-prepare"/>
  
  <!-- sets up the build trees for sources and tests                       -->
  
  <target name="basic-prepare">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dest}"/>
    <mkdir dir="${build.test.dest}"/>
  </target>
  
  <!-- sets up the build environment (classpath and libs)                  -->
  
  <target name="build-prepare" depends="basic-prepare">
    <ant antfile="${ant.build.dir}/download.xml" target="build-download" />
    <!-- Build classpath -->
    <path id="build.classpath">
      <fileset dir="${build.lib}">
        <include name="**/*.jar"/>
      </fileset>
    </path>
    <!-- Test classpath, contains dependencies needed only for Testing -->
    <path id="test.classpath">
        <fileset dir="${build.test.lib}">
          <include name="**/*.jar"/>
        </fileset>
        <fileset dir="${build.lib}">
          <include name="**/*.jar"/>
        </fileset>
        <pathelement location="${build.dest}" />
        <pathelement location="${build.test.dest}" />
    </path>
    <path id="run.classpath">
      <path refid="build.classpath"/>
      <pathelement location="${build.dir}/${final.name}.jar"/>
    </path>
  </target>
  
  <!-- Compiles the source tree and the tests                              -->
  
  <target name="compile" depends="compile-src,compile-test"/>
  <target name="compile-src" depends="build-prepare"
          description="Compiles the source">
    <javac srcdir="${src.java.dir}"
      destdir="${build.dest}"
      encoding="UTF-8"
      debug="${debug}"
      deprecation="${deprecation}"
      optimize="${optimize}"
      classpathref="build.classpath"/>
    <copy todir="${build.dest}" filtering="yes">
      <fileset dir="${src.java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>
  </target>
  <target name="compile-test" depends="build-prepare,compile-src"
          description="Compiles the test classes">
    <javac srcdir="${test.java.dir}"
      destdir="${build.test.dest}"
      encoding="UTF-8"
      debug="${debug}"
      deprecation="${deprecation}"
      optimize="${optimize}">
      <!-- Don"t use the run classpath, build using the exploded class tree -->
      <classpath>
        <path refid="build.classpath"/>
        <path refid="test.classpath" />
        <pathelement location="${build.dest}"/>
      </classpath>
    </javac>
    <copy todir="${build.test.dest}" filtering="yes">
      <fileset dir="${test.java.dir}">
        <include name="**/*.properties"/>
      </fileset>
    </copy>
  </target>

  
  <!-- Compiles the source directory and creates a .jar file               -->
  
  <target name="jar" depends="compile-src"
          description="Builds the Jar file">
    <property name="jarname" value="${final.name}" />
    <jar jarfile="${build.dir}/${jarname}.jar">
      <metainf dir="${app.dir}">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </metainf>
      <fileset dir="${build.dest}"/>
      <manifest>
        <attribute name="Created-By" value="Apache Ant"/>
        <attribute name="Build-Jdk" value="${java.version}"/>
        <attribute name="Package" value="${mf.package}"/>
        <attribute name="Extension-Name" value="${mf.extension.name}"/>
        <attribute name="Specification-Title" value="${mf.specification.title}" />
        <attribute name="Specification-Vendor" value="${mf.specification.vendor}"/>
        <attribute name="Implementation-Title" value="${mf.implementation.title}"/>
        <attribute name="Implementation-Vendor-Id" value="${mf.implementation.vendor.id}"/>
        <attribute name="Implementation-Vendor" value="${mf.implementation.vendor}"/>
        <attribute name="Implementation-Version" value="${mf.implementation.version}"/>
      </manifest>
    </jar>
    <checksum file="${build.dir}/${jarname}.jar" algorithm="md5" property="checksum.jar.md5"/>
    <checksum file="${build.dir}/${jarname}.jar" algorithm="sha1" property="checksum.jar.sha1"/>
    <echo message="${checksum.jar.md5} *${jarname}.jar" file="${build.dir}/${jarname}.jar.md5" />
    <echo message="${checksum.jar.sha1} *${jarname}.jar" file="${build.dir}/${jarname}.jar.sha1" />
  </target>
  
  <!-- jars the source                                                    -->
  
  <target name="jar-src"
          depends="prepare"
          description="Builds the Source Jar File">
    <jar jarfile="${build.dir}/${final.name}-src.jar">
      <metainf dir="${app.dir}">
        <include name="LICENSE"/>
        <include name="NOTICE"/>
      </metainf>
      <fileset dir="${src.java.dir}"/>
      <manifest>
        <attribute name="Created-By" value="Apache Ant"/>
        <attribute name="Specification-Title" value="${mf.specification.title}" />
        <attribute name="Specification-Vendor" value="${mf.specification.vendor}"/>
        <attribute name="Implementation-Title" value="${mf.implementation.title}"/>
        <attribute name="Implementation-Vendor-Id" value="${mf.implementation.vendor.id}"/>
        <attribute name="Implementation-Vendor" value="${mf.implementation.vendor}"/>
        <attribute name="Implementation-Version" value="${mf.implementation.version}"/>
      </manifest>
    </jar>
    <checksum file="${build.dir}/${final.name}-src.jar" algorithm="md5" property="checksum.jar-src.md5"/>
    <checksum file="${build.dir}/${final.name}-src.jar" algorithm="sha1" property="checksum.jar-src.sha1"/>
    <echo message="${checksum.jar-src.md5} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.md5" />
    <echo message="${checksum.jar-src.sha1} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.sha1" />
  </target>
  
  <!-- Creates the API documentation                                       -->
  
  <target name="javadocs" depends="build-prepare"
          description="Creates the Javadoc API documentation">
    <mkdir dir="${build.javadoc}"/>
    <javadoc sourcepath="${src.java.dir}"
             packagenames="${javadoc.packagenames}"
             destdir="${build.javadoc}"
             author="true"
             private="false"
             version="true"
             use="true"
             windowtitle="${name} ${version} API"
             doctitle="${name} ${version} API"
             encoding="UTF-8"
             docencoding="UTF-8"
             bottom="Copyright &#169; 2000-${build.year} &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache Software Foundation&lt;/a&gt;. All Rights Reserved."
             classpathref="build.classpath">
      <link href="${javadocs.ref.jsdk}"/>
      <link href="http://www.jdom.org/docs/apidocs"/>
      <link href="http://logging.apache.org/log4j/docs/api"/>
      <link href="http://excalibur.apache.org/apidocs"/>
      <link href="http://tomcat.apache.org/tomcat-4.1-doc/servletapi"/>
      <link href="http://jakarta.apache.org/oro/api"/>
      <link href="http://jakarta.apache.org/commons/lang/api-release"/>
      <link href="http://jakarta.apache.org/commons/collections/api-release"/>
    </javadoc>
  </target>
  <target name="javadocs-clean">
    <delete dir="${build.javadoc}" quiet="true"/>
  </target>
  
  <!-- Package                                                             -->
  
  <target name="build-package-tree" depends="clean,jar,docs,javadocs">

    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${dist.dir}/src/java"/>
    <copy todir="${dist.dir}/src/java/">
      <fileset dir="${src.java.dir}" />
    </copy>
    <copy todir="${dist.dir}/src/test/">
      <fileset dir="${test.java.dir}" />
    </copy>
    <copy todir="${dist.dir}/lib">
      <fileset dir="${build.lib}" />
    </copy>
    <copy todir="${dist.dir}/lib/test">
      <fileset dir="${build.test.lib}" />
    </copy>
    <copy todir="${dist.dir}/build">
      <fileset dir="${app.dir}/build">
        <include name="**"/>
        <exclude name="velocity.log"/>
      </fileset>
    </copy>
    <!-- Copy docs, exclude API docs -->
    <copy todir="${dist.dir}/docs">
      <fileset dir="${build.docs}">
        <include name="**"/>
        <exclude name="docs/api/**"/>
      </fileset>
    </copy>
    <!-- Add freshly built Java docs -->
    <copy todir="${dist.dir}/docs/api">
      <fileset dir="${build.javadoc}">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}/test">
      <fileset dir="${app.dir}/test">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}/xdocs">
      <fileset dir="${xdocs.dir}">
        <include name="**"/>
      </fileset>
    </copy>
    <copy todir="${dist.dir}">
      <fileset dir="${app.dir}">
        <include name="LICENSE" />
        <include name="NOTICE" />
        <include name="README.txt" />
        <include name="pom.xml" />
      </fileset>
    </copy>
    <copy
      file="${build.dir}/${final.name}.jar"
      tofile="${dist.dir}/${final.name}.jar"
    />
  </target>
  
  <!-- Packages the distribution with ZIP                                 -->
  
  <target name="package-zip"
          depends="build-package-tree">
    <!-- .zip built for Windows -->
    <fixcrlf srcdir="${dist.dir}" eol="crlf" eof="asis" encoding="ISO-8859-1">
      <include name="**/*.html" />
      <include name="**/*.java" />
      <include name="**/*.properties" />
      <include name="**/*.txt" />
      <include name="**/*.xml" />
    </fixcrlf>
    <delete file="${build.dir}/${final.name}.zip" quiet="true"/>
    <zip zipfile="${build.dir}/${final.name}.zip" basedir="${dist.root}"
         includes="**/${final.name}/**"/>
    <checksum file="${build.dir}/${final.name}.zip" algorithm="md5" property="checksum.zip.md5"/>
    <checksum file="${build.dir}/${final.name}.zip" algorithm="sha1" property="checksum.zip.sha1"/>
    <echo message="${checksum.zip.md5} *${final.name}.zip" file="${build.dir}/${final.name}.zip.md5" />
    <echo message="${checksum.zip.sha1} *${final.name}.zip" file="${build.dir}/${final.name}.zip.sha1" />
  </target>
  
  <!-- Packages the distribution with TAR-GZIP                            -->
  
  <target name="package-tgz"
          depends="build-package-tree">
    <!-- .tar.gz built for Unix -->
    <fixcrlf srcdir="${dist.dir}" eol="lf" eof="remove" encoding="ISO-8859-1">
      <include name="**/*.html" />
      <include name="**/*.java" />
      <include name="**/*.properties" />
      <include name="**/*.txt" />
      <include name="**/*.xml" />
    </fixcrlf>
    <delete file="${build.dir}/${final.name}.tar.gz" quiet="true"/>
    <tar tarfile="${build.dir}/${final.name}.tar.gz" basedir="${dist.root}"
         includes="**/${final.name}/**" longfile="gnu" compression="gzip" />
    <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="md5" property="checksum.tgz.md5"/>
    <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="sha1" property="checksum.tgz.sha1"/>
    <echo message="${checksum.tgz.md5} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.md5" />
    <echo message="${checksum.tgz.sha1} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.sha1" />
  </target>

  
  <!-- Packages the distribution with ZIP and TAR-GZIP                    -->
  
  <target name="package"
          depends="package-zip,package-tgz"
          description="Generates the distribution files">
  </target>
  
  
  <!-- Cleans up the build directory. Leave Libs unharmed to avoid re-download -->
  
  <target name="clean" 
          description="Cleans all generated files except downloaded libs">
    <delete includeEmptyDirs="true" quiet="true">
      <fileset dir="${build.dir}" defaultexcludes="no">
        <exclude name="lib/**" />
        <exclude name="test-lib/**" />
      </fileset>
      <fileset dir="${ant.build.dir}" defaultexcludes="no">
        <include name="velocity.log" />
      </fileset>
    </delete>
  </target>
  
  <!-- Really cleans up the build directory                                -->
  
  <target name="real-clean" 
          description="Cleans all generated files">
    <delete includeEmptyDirs="true" quiet="true" dir="${build.dir}" />
  </target>
  
  <!-- Make HTML version of the documentation                         -->
  
  <target name="docs" depends="build-prepare,jar"
          description="Generates the HTML documentation">
    <taskdef name="anakia"
             classname="org.apache.anakia.AnakiaTask"
             classpathref="run.classpath"/>
    <echo>
  #######################################################
  #
  #  Now using Anakia to transform the XML documentation
  #  to HTML.
  #######################################################
    </echo>
    <anakia basedir="${xdocs.dir}/docs" destdir="${build.docs}"
         extension=".html" style="site.vsl"
         projectFile="../stylesheets/project.xml"
         includes="**/*.xml"
         lastModifiedCheck="true"
         templatePath="${xdocs.dir}/stylesheets">
    </anakia>
    <copy todir="${build.docs}/images" filtering="no">
        <fileset dir="${xdocs.dir}/images">
            <include name="**/*.gif"/>
            <include name="**/*.jpeg"/>
            <include name="**/*.jpg"/>
            <include name="**/*.png"/>
        </fileset>
    </copy>
    <copy todir="${build.docs}" filtering="no">
        <fileset dir="${xdocs.dir}">
            <include name="**/*.css"/>
            <include name="**/.htaccess"/>
        </fileset>
    </copy>
  </target>

  
  <!-- Cleans up the docs directory                                       -->
  
  <target name="docs-clean">
    <delete dir="${build.docs}" quiet="true"/>
  </target>

  
  <!-- JUnit Tests                                                         -->
  
  <target name="test-clean">
    <delete dir="${build.test.dest}" quiet="true"/>
    <delete dir="${build.test}" quiet="true"/>
    <delete dir="${build.test.reports}" quiet="true"/>
  </target>

  <target name="test"
          depends="build-prepare,compile-test,test-anakia"/>

  <target name="test-anakia">
    <echo message="Running Anakia tests..."/>
    <taskdef name="anakia" classname="org.apache.anakia.AnakiaTask"
             classpathref="test.classpath"/>
    <!-- run twice - once with custom context and once without -->
    <anakia basedir="${test.dir}/anakia/xdocs"
            destdir="${build.test}/anakia"
        extension=".html" style="./site_contexts.vsl"
        projectFile="./stylesheets/project.xml"
        excludes="**/stylesheets/**"
        includes="**/*.xml"
        templatePath="${test.dir}/anakia/xdocs/stylesheets"
        lastModifiedCheck="false">
    </anakia>
    <anakia basedir="${test.dir}/anakia/xdocs"
            destdir="${build.test}/anakia"
        extension=".context.html" style="./site_contexts.vsl"
        projectFile="./stylesheets/project.xml"
        excludes="**/stylesheets/**"
        includes="**/*.xml"
        templatePath="${test.dir}/anakia/xdocs/stylesheets"
        lastModifiedCheck="false">
        <context name="customContext" file="./stylesheets/customContext.xml"/>
    </anakia>
    <java classname="${test.runner}" fork="yes" dir="${app.dir}" failonerror="${test.haltonerror}"
          classpathref="test.classpath">
      <arg value="org.apache.anakia.AnakiaTestCase"/>
    </java>
  </target>

</project>





Set source version in javac

 
<?xml version="1.0"?>
<project name="yourName" default="junitgui" basedir=".">
  <property name="junitJar" value="\junit3.8.1\junit.jar" />
  <property name="src.dir" value="${basedir}\src" />
  <property name="build.dir" value="${basedir}\classes" />
  <path id="classpath">
    <pathelement location="${junitJar}" />
    <pathelement location="${build.dir}" />
  </path>
  <target name="init">
    <mkdir dir="${build.dir}" />
  </target>
  <target name="build" depends="init" description="build all">
    <javac
        srcdir="${src.dir}" destdir="${build.dir}"
        source="1.5" 
        deprecation="on" debug="on" optimize="off" includes="**">
      <classpath refid="classpath" />
    </javac>
  </target>
  <target name="junitgui" depends="build" description="run junitgui">
    <java classname="junit.awtui.TestRunner" fork="yes">
      <arg value="sis.AllTests" />
      <classpath refid="classpath" />
    </java>
  </target>
   <target name="clean">  
    <delete dir="${build.dir}" />
  </target>
   <target name="rebuildAll" depends="clean,build" description="rebuild all"/>
</project>





Set target for javac

 
//COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 
<project name="ajax4jsf" default="distribute">
  <property name="commonLibs.dir" value="${basedir}/commonLibs"></property>
  
  <property name="distrib.dir" value="${basedir}/distribution"/>
  <property name="work.dir" value="${basedir}/build"/>
  
  <property name="src.root.dir" value="${basedir}/src"></property>
  
  <property name="test.src.dir" value="${src.root.dir}/testCase"></property>
  <property name="framework.src.dir" value="${src.root.dir}/framework"></property>
  <property name="framework.java.src.dir" value="${framework.src.dir}/java"></property>
  <property name="framework.js.src.dir" value="${framework.src.dir}/JavaScript"></property>
  <property name="framework.generate.src.dir" value="${framework.src.dir}/generate"></property>
  <property name="framework.build.dir" value="${work.dir}/framework"></property>
  <property name="cdk.src.dir" value="${src.root.dir}/cdk"></property>
  <property name="cdk.build.dir" value="${work.dir}/cdk"></property>
    <property name="test.src.dir" value="${src.root.dir}/test"></property>
    <property name="test.build.dir" value="${work.dir}/test"></property>
  <property name="doc.root.dir" value="${distrib.dir}/docs"></property>
  <property name="tlddoc.dir" value="${doc.root.dir}/tldDoc"></property>
  <property name="javadoc.dir" value="${doc.root.dir}/javaAPI"></property>
  <property name="tlddoc.jar" value="${commonLibs.dir}/tlddoc.jar"></property>
  
  <property name="framework-distribution-name" value="ajax4jsf"></property>
  <property name="cdk-distribution-name" value="ajax4jsf-cdk" />
    <property name="test-distribution-name" value="ajax4jsf-test" />
  
  <property name="generated-source.dir" value="${work.dir}/gen-src"></property>
  
  <fileset id="commonLibs" dir="${commonLibs.dir}">
    <include name="*.jar"/>
  </fileset>
  
  <path id="class-path">
    <fileset refid="commonLibs"></fileset>
  </path>
  <target name="prepare">
    <mkdir dir="${distrib.dir}"/>
    <mkdir dir="${work.dir}"/>
  </target>
  
  <target name="generate-framework" depends="compile-framework,compile-cdk">
    <ant antfile="${framework.generate.src.dir}/build.xml" inheritall="true" dir="${basedir}" target="xml-merge">
    </ant>
  </target>

  <target name="prepare-framework">
    <mkdir dir="${framework.build.dir}" />
  </target>
  <target name="prepare-cdk">
    <mkdir dir="${cdk.build.dir}" />
  </target>
    <target name="prepare-test">
        <mkdir dir="${test.build.dir}" />
    </target>
  
  <target name="compile-framework" depends="prepare-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
            failonerror="false"         
      debuglevel="lines,vars,source">
      <classpath refid="class-path"></classpath>
      <src path="${framework.src.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${framework.java.src.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*faces-config.xml"/>
      </fileset>
    </copy>
  </target>
  <target name="compile-cdk" depends="prepare-cdk">
    <javac 
      destdir="${cdk.build.dir}"
      compiler="javac1.5" 
      source="1.5" 
      target="1.5" 
      debug="true" 
      debuglevel="lines,vars,source">
        <classpath refid="class-path"></classpath>
      <src path="${cdk.src.dir}"></src>
    </javac>
    <copy todir="${cdk.build.dir}/META-INF">
      <fileset dir="${cdk.src.dir}/META-INF">
        <include name="**/*.*"/>
      </fileset>        
    </copy>    
  </target>
  
    <target name="compile-test" depends="prepare-test">
        <javac 
            destdir="${test.build.dir}"
            compiler="javac1.4" 
            source="1.4" 
            target="1.4" 
            debug="true" 
            debuglevel="lines,vars,source"
            includes="org/ajax4jsf/tests/*.*" >
                <classpath refid="class-path"></classpath>
            <classpath path="${framework.build.dir}"></classpath>   
            <src path="${test.src.dir}">
            </src>
        </javac>
        <copy todir="${test.build.dir}/META-INF">
            <fileset dir="${test.src.dir}/META-INF">
                <include name="**/*.*"/>
            </fileset>              
        </copy>     
        <copy todir="${test.build.dir}/WEB-INF">
            <fileset dir="${test.src.dir}/WEB-INF">
                <include name="**/*.*"/>
            </fileset>              
        </copy>     
    </target>
    <target name="compile-framework-phase2" depends="generate-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
      debuglevel="lines,vars,source">
      <classpath>
        <path>
        <path refid="class-path"></path>
        <pathelement path="${framework.build.dir}"/>
        </path>
      </classpath>
      <src path="${generated-source.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${generated-source.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*-faces-config.xml"/>
      </fileset>
    </copy>
  </target>
  
  <target name="assemble-javascripts" depends="prepare-framework">
    <ant antfile="${framework.js.src.dir}/build.xml" dir="${framework.js.src.dir}">
      <property name="target-dir" value="${framework.build.dir}"></property>
    </ant>
  </target>
  
  <target name="build-framework" depends="compile-framework,assemble-javascripts,compile-framework-phase2">
  </target>
  <target name="build-cdk" depends="compile-cdk">
  </target>
  
    <target name="build-test" depends="compile-test">
    </target>
        <target name="prepare-distribution-dir">
    <mkdir dir="${distrib.dir}/lib"/>
  </target>
  
  <target name="package-framework" depends="build-framework, prepare-distribution-dir">
    <jar destfile="${distrib.dir}/lib/${framework-distribution-name}.jar">
      <fileset dir="${framework.build.dir}">
        <include name="**/*.*"/>
      </fileset>
    </jar>
  </target>
  
  <target name="package-cdk" depends="prepare-distribution-dir,build-cdk">
    <jar destfile="${distrib.dir}/lib/${cdk-distribution-name}.jar">
      <fileset dir="${cdk.build.dir}">
        <include name="**/*.*"/>
      </fileset>
    </jar>
  </target>
    <target name="package-test" depends="prepare-distribution-dir,build-test">
        <jar destfile="${distrib.dir}/lib/${test-distribution-name}.jar">
            <fileset dir="${test.build.dir}">
                <include name="**/*.*"/>
            </fileset>
        </jar>
    </target>
  <target name="prepare-docs">
    <mkdir dir="${doc.root.dir}"/>
  </target>
  
  <target name="docs" depends="prepare-docs, javadoc, tlddoc, copy-doc">
    
  </target>
  
  <target name="copy-doc" depends="prepare-docs">
    <copy todir="${doc.root.dir}" failonerror="false">
      <fileset dir="${basedir}/doc">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="javadoc">
    <mkdir dir="${javadoc.dir}"/>
    <javadoc packagenames="org.*" destdir="${javadoc.dir}">
      <sourcepath>
        <pathelement path="${framework.java.src.dir}"/>
      </sourcepath>
      <classpath refid="class-path"></classpath>
    </javadoc>
  </target>
  
  <target name="tlddoc">
    <mkdir dir="${tlddoc.dir}"/>
    <echo message="${tlddoc.jar}"></echo>
    <apply executable="java" parallel="true" verbose="true">
      <!-- dir="${tlddoc.dir}">-->
      <arg line="-jar ${tlddoc.jar}"/>
      <arg line="-doctitle "AJAX4JSF""/>
      <!--arg line="-xslt ${tlddocxsl.dir}"/-->
      <arg line="-d ${tlddoc.dir}"/>
      <fileset dir="${framework.build.dir}/META-INF" includes="**.tld"/>
    </apply>
  </target>
  
  <target name="copy-dependencies" depends="prepare-distribution-dir">
    <copy todir="${distrib.dir}/lib">
      <fileset dir="${commonLibs.dir}">
        <include name="oscache*.jar"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-src">
    <mkdir dir="${distrib.dir}/src"/>
    <copy todir="${distrib.dir}/src">
      <fileset dir="${framework.src.dir}">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-demo">
    <mkdir dir="${distrib.dir}/demo"/>
    <copy todir="${distrib.dir}/demo" failonerror="false">
      <fileset dir="${basedir}/demo">
        <include name="**/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="copy-txt">
    <copy todir="${distrib.dir}">
      <fileset dir="${basedir}">
        <include name="*.txt"/>
        <include name="*.TXT"/>
      </fileset>
    </copy>
  </target>
  
  <target name="build-test-framework">
    <javac 
      destdir="${framework.build.dir}"
      compiler="javac1.4" 
      source="1.4" 
      target="1.4" 
      debug="true" 
      debuglevel="lines,vars,source">
      <classpath refid="class-path"></classpath>
      <src path="${test.src.dir}"></src>
    </javac>
    <copy todir="${framework.build.dir}">
      <fileset dir="${test.src.dir}">
        <include name="**/*.*"/>
        <exclude name="**/*.java"/>
        <exclude name="META-INF/*"/>
        <exclude name="WEB-INF/*"/>
      </fileset>
    </copy>
  </target>
  
  <target name="distribute" depends="clean,build-framework,package-framework, copy-dependencies, docs, copy-src, copy-txt, copy-demo, package-cdk, package-test">
    <!--delete dir="${work.dir}"></delete-->
    <delete file="${basedir}/velocity.log" failonerror="false" verbose="true"></delete>
  </target>
  
  <target name="clean">
    <delete dir="${work.dir}"></delete>
    <delete includeemptydirs="true" failonerror="false">
      <fileset dir="${distrib.dir}">
        <include name="**/*"/>
      </fileset>
    </delete>
  </target>
</project>





Use a precompiler with Java

  
Your Java code:
//@START@//
    your code
//@END@//

   <target name="compileprod">
    <copy todir="out">
        <filterchain>
            <tokenfilter>
                <replacestring from="//@START@//" to="/*" />
                <replacestring from="//@END@//" to="*/" />
            </tokenfilter>
        </filterchain>
        <fileset dir=".">
          <include name="**/*.java" />
       </fileset>
    </copy>
   </target>