到底先有雞還是先有蛋?

          建立web應(yīng)用的 ant build.xml 模板

          一、建立Web應(yīng)用步驟
          1、清空臨時目錄
          2、建立目錄結(jié)構(gòu)
          3、從vss或cvs中獲得源文件
          4、編譯(編譯java源文件、copy屬性文件和xml等文件、編碼轉(zhuǎn)換)
          5、建立WAR包
          6、發(fā)布

          二、建立web應(yīng)用的 build.xml 模板

          <?xml version="1.0"?>

          <!--
            =======================================================================
            build file

              =======================================================================
          -->
          <project default="main" basedir="build">

            <property name="file.war" value="myapp.war"/>

            <property name="dir.jdk" value="c:/jbuilderx/jdk1.4"/>

            <property name="dir.src" value="src"/>
            <property name="dir.classes" value="classes"/>
            <property name="dir.lib" value="lib"/>
            <property name="dir.web" value="web"/>

            <property name="vss.login" value="userId,password"/>
            <property name="vss.serverPath" value="i:\"/>
            <property name="vss.srcPath" value="/myproject/src"/>
            <property name="vss.libPath" value="/myproject/lib"/>
            <property name="vss.webPath" value="/myproject/webapp"/>

            <property name="server.ftp.userId" value="ftpuser"/>
            <property name="server.ftp.password" value="ftppassword"/>
            <property name="server.ftp.serverIp" value="192.168.0.1"/>

            <path id="project.class.path">
              <pathelement location="${dir.classes}"/>
           <pathelement location="${dir.jdk}/jre/lib/rt.jar"/>

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

            <target name="clean">
             <delete dir="${dir.src}"/>
             <delete dir="${dir.classes}"/>
             <delete dir="${dir.lib}"/>
            </target>
           
            <target name="init" depends="clean">
             <mkdir dir="${dir.src}"/>
             <mkdir dir="${dir.classes}"/>
             <mkdir dir="${dir.lib}"/>
            </target>

            <target name="getFromVcm" depends="init">
           <vssget localPath="${dir.src}"
            login="${vss.login}"
            vsspath="${vss.srcPath}"
            recursive="true"
            serverPath="${vss.serverPath}"
            writable="true"/>

           <vssget localPath="${dir.lib}"
            login="${vss.login}"
            vsspath="${vss.libPath}"
            recursive="true"
            serverPath="${vss.serverPath}"
            writable="true"/>
           
           <vssget localPath="${dir.web}"
            login="${vss.login}"
            vsspath="${vss.webPath}"
            recursive="true"
            serverPath="${vss.serverPath}"
            writable="true"/>
           
            </target>

            <target name="compile" depends="getFromVcm">
           <javac bootclasspathref="project.class.path" debug="true"
                  deprecation="true" destdir="${dir.classes}" nowarn="false" target="1.2">
                <src path="${dir.src}"/>
              </javac>
           <copy todir="${dir.classes}">
             <fileset dir="${dir.src}">
              <include name="**/*.properties"/>
                <include name="**/*.xml"/>
              <exclude name="ApplicationResources.properties"/>
              </fileset>
           </copy>
           <native2ascii encoding="GBK" src="${dir.src}" dest="${dir.classes}"
              includes="ApplicationResources.properties"/>
            </target>

            <target name="buildWar" depends="compile">
           <war destfile="${file.war}" webxml="${dir.web}/WEB-INF/web.xml">
            <lib dir="${dir.lib}"/>
            <classes dir="${dir.classes}"/>
            <fileset dir="${dir.web}"/>
           </war>
            </target>

            <target name="deploy" depends="buildWar">
              <ftp server="${server.ftp.serverIp}"
              userid="${server.ftp.userId}"
                 password="${server.ftp.password}">
           <fileset dir=".">
                <include name="${file.war}"/>
              </fileset>
           </ftp>
            </target>

            <target name="main" description="" depends="deploy"/>

          </project>

          posted on 2005-08-09 18:56 螞蚱 閱讀(2760) 評論(1)  編輯  收藏

          評論

          # re: 建立web應(yīng)用的 ant build.xml 模板 2005-08-10 22:18 鳥不生蛋蛋的地方

          不錯,挺有用的~  回復(fù)  更多評論   


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          <2005年8月>
          31123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導(dǎo)航

          統(tǒng)計

          常用鏈接

          留言簿(3)

          隨筆檔案

          收藏夾

          eclipse

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          maja
          主站蜘蛛池模板: 浦城县| 涟源市| 灵丘县| 中超| 涞水县| 龙陵县| 东安县| 洛扎县| 鄂伦春自治旗| 岚皋县| 本溪市| 阜阳市| 分宜县| 青浦区| 阳原县| 屏东县| 赫章县| 鄂州市| 营口市| 靖边县| 郴州市| 达拉特旗| 武强县| 若羌县| 凭祥市| 定远县| 开远市| 塔河县| 铜梁县| 新营市| 丽水市| 德昌县| 东城区| 鱼台县| 永靖县| 启东市| 南京市| 巴楚县| 页游| 建湖县| 洮南市|