<!-- $Id$ -->

<project name="Tomcat example" default="war">

  <description>Tomcat Example</description>

  <property name="lib" value="${basedir}/../../lib"/>
  <property name="config" value="${basedir}/../../config"/>
  <property name="src" value="${basedir}/src"/>
  <property name="output" value="${basedir}/output"/>

  <target name="init">
    <!-- use externals if lib not available -->
    <condition property="lib" value="${basedir}/../../externals">
      <not>
        <available file="${lib}" />
      </not>
    </condition>
    <mkdir dir="${output}"/>
  </target>

  <target name="compile" depends="init"
    description="--> compile the example">
    <javac 
      debug="true"
      srcdir="${src}" destdir="${output}">
      <classpath>
        <pathelement location="${lib}/jta-spec1_0_1.jar"/>
        <pathelement location="${lib}/jotm.jar"/>
        <pathelement location="${lib}/xapool.jar"/>
      </classpath>
    </javac>
  </target>

  <target name="war" depends="compile"
    description="--> create a war file">
    <war destfile="${output}/dbtest.war" webxml="${basedir}/web.xml">
      <fileset dir="${basedir}">
  	<include name="**/*.jsp" />
      </fileset>
      <classes dir="${output}">
	<include name="foo/DBTest.class" />
      </classes>
    </war>
  </target>

  <target name="clean" depends="init"
    description="--> clean generated files">
    <delete dir="${output}"/>
  </target>
</project>