ant

xiaoxiao2023-03-22  63

1.下载编译ant所需要的包文件 http://ant.apache.org/ 2.主要的配置文件build.xml <?xml version="1.0" encoding="gbk"?> <!--default属性代表编译时的入口target--> <project name="AntTest" default="anttest" basedir="."> <!--初始化程序所需要的一些环境变量--> <target name="init"> <property name="build" value="build"/> <property name="src" value="src"/> <property environment="myenv"/> <property name="servletpath" value="${myenv.CATALINA_HOME}/lib/servlet-api.jar"/> <mkdir dir="${build}"/> <mkdir dir="${build}\WEB-INF"/> <mkdir dir="${build}\WEB-INF\classes"/> <echo message="${servletpath}"/> <copy todir="${build}"> <!--build.xml放在WebRoot同级目录--> <fileset dir="${basedir}/WebRoot"> <include name="*.jsp"/> <include name="WEB-INF/**"/> <exclude name="build.xml"/> </fileset> </copy> </target> <!--编译之前必须初始化init--> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${build}/WEB-INF/classes" classpath="${servletpath}"> </javac> </target> <!--程序打war包--> <target name="anttest" depends="compile"> <war warfile="${build}/anttest.war" webxml="${build}/WEB-INF/web.xml"> <lib dir="${build}/WEB-INF/lib"/> <classes dir="${build}/WEB-INF/classes"/> <fileset dir="${build}"/> </war> </target> <target name="about"> <echo> this build.xml build antest success! </echo> </target> </project> 3.附件为帮助文档!
转载请注明原文地址: https://www.6miu.com/read-4987459.html
最新回复(0)