<project name="spring_java_1.0m3_XMLBEANS_2.1.0" default="package">

	<path id="project.classpath">
		<pathelement location="build/classes"/>
		<fileset dir="lib" includes="*.jar"/>
    </path>

	<target name="clean">
		<delete dir="build"/>
	</target>
	
	<target name="init">
		<mkdir dir="build"/>
	</target>
	
	<target name="generate" depends="init">
		<mkdir dir="build/generated"/>
		<mkdir dir="build/classes"/>
		<taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="project.classpath"/>
		<xmlbean srconly="false" classgendir="build/classes" classpathref="project.classpath" srcgendir="build/generated" schema="examples.xsd"/>
	</target>
	
	<target name="compile" depends="generate">
		<mkdir dir="build/classes"/>
		<javac classpathref="project.classpath" destdir="build/classes" debug="on">
			<src path="build/generated"/>
			<src path="src/java"/>
		</javac>
	</target>

	<target name="package" depends="compile">
		<property file="spring.properties"/>
		<mkdir dir="build/tmp/org/w3c/dbwg"/>
		<copy file="applicationContext-ws.xml.template" tofile="build/tmp/org/w3c/dbwg/applicationContext-ws.xml" overwrite="true">
			<filterset>
				<filter token="PROPS" value="${spring.mappings}"/>
			</filterset>
		</copy>
		<jar destfile="build/${ant.project.name}.jar">
			<fileset dir="build/classes"/>
			<fileset dir="build/tmp" includes="**/*.xml"/>
		</jar>
		<war destfile="build/databinding.war" webxml="src/web/WEB-INF/web.xml">
			<webinf dir="src/web/WEB-INF"/>
			<lib dir="lib" excludes="jaxb-xjc*.jar"/>
			<lib dir="build" includes="${ant.project.name}.jar"/>
			<fileset dir="." includes="*.xsd,*.wsdl"/>
		</war>
	</target>

	<target name="deploy">
		<copy file="build/databinding.war" todir="C:/jboss-4.0.5.GA/server/default/deploy" overwrite="true"/>
	</target>
	
</project>