<?xml version="1.0" encoding="UTF-8"?> <project name="webAnt" default="fabu" basedir="."> <property name="build" value="${basedir}/build" /> <property name="build.class" value="${build}/classes" /> <property name="src" value="${basedir}/src" /> <property name="webRoot" value="${basedir}/WebRoot" /> <property name="webxml" value="${webRoot}/WEB-INF/web.xml" /> <property name="lib" value="${webRoot}/WEB-INF/lib" /> <path id="lib"> <fileset dir="${lib}"> <include name="*.jar"/> </fileset> </path> <property name="webserver" value="C:\apache-tomcat-6.0.24\webapps" /> <!--删除任务--> <target name="clean" description="删除"> <echo message="删除目录" /> <delete dir="${build}" /> </target> <target name="init" description="创建目录" depends="clean"> <echo message="创建目录--以执行" /> <mkdir dir="${build.class}" /> </target> <!--编译java源文件--> <target name="compile" description="编译文件" depends="init"> <echo message="编译文件" /> <property environment="env"/> <property name="servletapi" value="${env.CATALINA_HOME}/lib/servlet-api.jar"/> <javac srcdir="${src}" destdir="${build.class}" encoding="GBK" source="1.6" target="1.6" debug="true" deprecation="false" optimize="false" failonerror="true" classpath="${servletapi}"> <classpath refid="lib"/> <compilerarg value="-Xlint:unchecked -Xlint:deprecation" /> </javac> </target> <target name="generwar" depends="compile"> <war destfile="${build}/${ant.project.name}.war" webxml="${webxml}"> <fileset dir="webRoot"> <include name="*.jsp" /> <include name="*.ico" /> <include name="**/*.*"/> </fileset> <lib dir="${lib}"> <include name="*.jar" /> </lib> <classes dir="${build.class}" /> </war> </target> <target name="deleteWar" description="删除服务器上的war"> <delete dir="${build}/${ant.project.name}.war" /> </target> <target name="fabu" depends="deleteWar,generwar" description="发布"> <copy file="${build}/${ant.project.name}.war" todir="${webserver}"> </copy> </target> </project>
借鉴了别人的文章,主要用web项目的编译,打包,部署到tomcat上。
1 楼
xfyuanjun
2012-06-15
不知道关于wensphere的有没有呢,兄弟,你测试过这个没。。