<?xml version="1.0"?>

<project name="spring-ws-airline-sample-axis-client" default="build"
        xmlns:artifact="urn:maven-artifact-ant">
    <property name="bin.dir" value="bin"/>
    <property name="src.dir" value="src"/>
    <property name="gen.dir" value="gen"/>
    <property name="wsdl" value="http://localhost:8080/airline/airline.wsdl"/>

    <target name="init">
        <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
            <classpath>
                <pathelement location="${basedir}/../../../maven-ant-tasks-2.0.7.jar"/>
            </classpath>
        </typedef>

        <artifact:dependencies pathId="generate.classpath">
            <dependency groupId="axis" artifactId="axis-ant" version="1.4"/>
            <dependency groupId="axis" artifactId="axis" version="1.4"/>
        </artifact:dependencies>

         <artifact:dependencies pathId="compile.classpath">
             <dependency groupId="axis" artifactId="axis" version="1.4"/>
         </artifact:dependencies> 

    </target>

    <target name="generate" depends="init">
        <mkdir dir="${gen.dir}"/>
        <taskdef resource="axis-tasks.properties" classpathref="generate.classpath"/>

        <axis-wsdl2java
                output="${gen.dir}"
                url="${wsdl}">
            <mapping
                    namespace="http://www.springframework.org/spring-ws/samples/airline/schemas/messages"
                    package="org.springframework.ws.samples.airline.client.axis1"/>
            <mapping
                    namespace="http://www.springframework.org/spring-ws/samples/airline/schemas/types"
                    package="org.springframework.ws.samples.airline.client.axis1"/>
            <mapping
                    namespace="http://www.springframework.org/spring-ws/samples/airline/definitions"
                    package="org.springframework.ws.samples.airline.client.axis1"/>
        </axis-wsdl2java>

    </target>


    <target name="build" depends="generate">
        <mkdir dir="${bin.dir}"/>
        <javac destdir="${bin.dir}">
            <src path="${src.dir}"/>
            <src path="${gen.dir}"/>
            <classpath refid="compile.classpath"/>
        </javac>
    </target>

    <target name="clean">
        <delete dir="${bin.dir}"/>
        <delete dir="${gen.dir}"/>
    </target>

    <target name="run" depends="build">
        <java classname="org.springframework.ws.samples.airline.client.axis1.Main" fork="true" failonerror="true">
            <classpath refid="compile.classpath"/>
            <classpath location="${bin.dir}"/>
        </java>
    </target>

</project>
