ant macrodef example

<macrodef name="cxfrun">
        <attribute name="logging-properties-file" default="${cxf.etc.dir}/logging.properties"/>
        <attribute name="classname"/>
        <attribute name="param1" default=""/>
        <attribute name="param2" default=""/>
        <attribute name="param3" default=""/>
        <attribute name="param4" default=""/>
        <attribute name="param5" default=""/>
        <attribute name="jvmarg1" default="-D' '"/>
        <attribute name="jvmarg2" default="-D' '"/>
        <attribute name="jvmarg3" default="-D' '"/>
        <attribute name="jvmarg4" default="-D' '"/>
        <attribute name="jvmarg5" default="-D' '"/>
        <sequential>
            <java classname="@{classname}" fork="yes">
                <classpath>
                    <path refid="cxf.classpath"/>
                    <pathelement path="${thirdparty.classpath}"/>
                    <path refid="jdk.tools.classpath"/>
                </classpath>
                <arg value="@{param1}"/>
                <arg value="@{param2}"/>
                <arg value="@{param3}"/>
                <arg value="@{param4}"/>
                <arg value="@{param5}"/>
                <jvmarg value="@{jvmarg1}"/>
                <jvmarg value="@{jvmarg2}"/>
                <jvmarg value="@{jvmarg3}"/>
                <jvmarg value="@{jvmarg4}"/>
                <jvmarg value="@{jvmarg5}"/>
                <!--assertions>
                    <enable package="org.apache.cxf"/>
                </assertions-->
                <sysproperty key="java.util.logging.config.file" value="@{logging-properties-file}"/>
            </java>
        </sequential>
    </macrodef>

    <macrodef name="wsdl2java">
        <attribute name="srcdestdir" default="${build.src.dir}"/>
        <attribute name="destdir" default="${build.classes.dir}"/>
        <attribute name="file"/>
        <attribute name="servicename.arg" default=""/>
        <attribute name="bindingfile" default=""/>
        <attribute name="dir" default="${wsdl.dir}"/>
        <attribute name="package" default="NOT_SPECIFIED"/>
        <sequential>
            <mkdir dir="@{destdir}"/>
            <mkdir dir="@{srcdestdir}"/>
            <condition property="package.arg.@{file}" value="-p @{package}">
                <not>
                    <equals arg1="@{package}" arg2="NOT_SPECIFIED"/>
                </not>
            </condition>
            <property name="package.arg.@{file}" value=""/>
            <condition property="binding.arg" value='-b "@{bindingfile}"'>
                <not>
                    <equals arg1="@{bindingfile}" arg2=""/>
                </not>
            </condition>
            <property name="binding.arg" value=""/>
            <java failonerror="true" classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="yes">
                <classpath>
                    <path refid="cxf.classpath" />
                </classpath>
                <sysproperty key="java.util.logging.config.file" value="${cxf.etc.dir}/logging.properties"/>
                <sysproperty key="exitOnFinish" value="true"/>
                <arg line="@{servicename.arg}"/>
                <arg line="${package.arg.@{file}}"/>
                <arg line="${binding.arg}"/>
                <arg value="-verbose"/>
                <arg value="-d"/>
                <arg value="@{srcdestdir}"/>
                <arg value="@{dir}/@{file}"/>
            </java>
        </sequential>
    </macrodef>

    <macrodef name="cxfwar">
        <attribute name="filename"/>
        <attribute name="wsdl"/>
        <attribute name="dir" default="${war.dir}"/>
        <attribute name="classesdir" default="${build.classes.dir}"/>
        <sequential>
            <mkdir dir="@{dir}"/>
            <war destfile="@{dir}/@{filename}" webxml="${cxf.home}/etc/web.xml">
                <classes dir="@{classesdir}"/>
                <webinf dir="${wsdl.dir}">
                    <include name="cxf-servlet.xml"/>
                </webinf>
                <webinf dir="${wsdl.dir}/..">
                    <include name="wsdl/@{wsdl}"/>
                </webinf>
            </war>
        </sequential>
    </macrodef>

你可能感兴趣的:(apache,jdk,xml,servlet,ant)