一、建立Web应用步骤
1、清空临时目录
2、建立目录结构
3、从vss或cvs中获得源文件
4、编译(编译java源文件、copy属性文件和xml等文件、编码转换)
5、建立WAR包
6、发布
二、建立web应用的 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 2006-10-18 09:50
水煮三国 阅读(1634)
评论(1) 编辑 收藏 所属分类:
OpenSource