浏览 2671 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2011-01-05
<?xml version="1.0" encoding="UTF-8"?> <project name="AntProject02" default="all" basedir="."> <property name="build.target.dir" value="target" /> <property name="app.name" value="AntProject02" /> <property name="app.war.name" value="${app.name}.war" /> <property name = "webRoot" value = "WebRoot"/> <property name = "webinf" value = "webRoot/WEB-INF"/> <property environment="env" /> <!-- 获取liunx,windows的环境变量 --> <property name="java.home" value="${env.JAVA_HOME}" /> <property name="ant.home" value="${env.ANT_HOME}" /> <!-- 1.设定 电脑环境变量 TOMCAT_HOMT 2.替换<property name="tomcat.home" value="${env.TOMCAT_HOME}" /> --> <property name="tomcat.home" value="D:/tomcat7/apache-tomcat-7.0.5/apache-tomcat-7.0.5" /> <path id="classpath"> <fileset dir="${webinf}/lib" includes="**/*.jar" /> </path> <target name="clean"> <delete dir="${build.target.dir}" /> </target> <target name="compile"> <mkdir dir="${build.target.dir}/${app.name}" /> <mkdir dir="${build.target.dir}/bin" /> <javac srcdir="src" destdir="${build.target.dir}/bin" source="1.6" target="1.6" debug="on"> <classpath refid="classpath" /> </javac> <copy todir="${build.target.dir}/bin"> <fileset dir="src"> <include name="*.xml" /> <include name="*.properties" /> </fileset> </copy> </target> <target name="build.war" depends="clean, compile"> <copy todir="${build.target.dir}/${app.name}"> <fileset dir="${webRoot}"> <exclude name="${webinf}/classes/**/*.class" /> </fileset> </copy> <copy todir="${build.target.dir}/${app.name}/WEB-INF/classes"> <fileset dir="${build.target.dir}/bin" /> </copy> <war destfile="${build.target.dir}/${app.war.name}" needxmlfile="false"> <fileset dir="${build.target.dir}/${app.name}" /> </war> </target> <target name="deploy" depends="build.war"> <delete dir="${tomcat.home}/webapps/${app.name}" /> <delete file="${tomcat.home}/webapps/${app.war.name}" /> <copy file="${build.target.dir}/${app.war.name}" todir="${tomcat.home}/webapps" /> </target> <target name="all" depends="clean,compile,build.war,deploy"></target> </project> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2011-01-08
代码一粘就万事?
|
|
返回顶楼 | |