随笔-11  评论-2  文章-2  trackbacks-0

今天写了一个简单ant,主要是准对web层打war包用的作为接下来webwork的学习做个铺垫吧!!

<?xml version="1.0" encoding="UTF-8"?>
<project name="webworkTest" default="war" basedir="../">
    <property file="build/build.properties"/>
    <property name="build.dir" value="build"/>
    <property name="dist.dir" value="dist"/>
    <property name="doc.dir" value="doc"/>
    <property name="docs.dir" value="docs"/>
    <property name="dtd.dir" value="dtd"/>
    <property name="lib.dir" value="lib"/>
    <property name="src.dir" value="src"/>
    <property name="classes.dir" value="classes"/>
    <property name="application.dir" value="application"/>

    <target name="init">
        <echo message="start"/>
        <property name="war.name" value="simapleDemo"/>
        <condition property="ifCopyProcessing">
            <equals arg1="isProcessing" arg2="off"/>
        </condition>
    </target>

    <target name="clean" depends="init">

        <delete dir=".">
            <include name="${dist.dir}/${war.name}.war"   />
        </delete>
        <delete dir="${classes.dir}">
            <patternset refid="war.classes"   />
            <patternset refid="war.configuationFile"/>
        </delete>
    </target>

    <path id="war.classpath">
        <fileset dir="${lib.dir}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <patternset id="war.configuationFile">
        <include name="xwork.xml"/>
    </patternset>

    <patternset id="war.classes">
        <include name="**/*.class"/>
        <exclude name="**/*Test.class"/>
    </patternset>

    <patternset id="war.lib">
        <include name="*.jar"/>
    </patternset>

    <target name="compile">
        <javac destdir="${classes.dir}" debug="on" source="1.4" description="false">
            <classpath refid="war.classpath"/>
            <src path="${src.dir}"/>
        </javac>
    </target>
    <target name="move">
        <copy todir="${classes.dir}" overwrite="true">
            <fileset dir=".">
                <include name="xwork.xml"/>
            </fileset>
        </copy>
    </target>
    <target name="war" depends="clean,compile,move" unless="ifCopyProcessing">
        <war warfile="${dist.dir}/${war.name}.war" webxml="${application.dir}/web.xml">
              <manifest>
                <attribute name="Build-by" value="${create.person}"/>
                <section name="com">
                    <attribute name="Implementation-version" value="${version}"/>
                </section>
            </manifest>


            <webinf dir="${docs.dir}/WEB-INF">
                <include name="tlds/"/>
            </webinf>

            <classes dir="${classes.dir}">
                <patternset refid="war.classes"/>
                <patternset refid="war.configuationFile" />
            </classes>

            <lib dir="${lib.dir}">
                <patternset refid="war.lib"/>
            </lib>

            <!--zipfileset dir="${lib.dir}" prefix="WEB-INF">
                 <include name="*.jar"/>
            </zipfileset-->
            <fileset dir="${docs.dir}" >
                <include name="*.jsp"/>
                <include name="jsp/*.jsp"/>
                <include name="tlds/**"/>
            </fileset>
        </war>
    </target>

    <target name="deploy" >
        <copy todir="${serverHome}" >
            <fileset dir="${dist.dir}">
                <include name="${war.name}.war"/>
            </fileset>
        </copy>
    </target>

    <target name="all" depends="war,deploy"></target>
</project>


posted on 2006-04-07 13:50 Billow 阅读(80) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: