build.xml

<?xml version="1.0" encoding="UTF-8"?> <project name="${project.name}" default="war" basedir="."> <property file="build.properties"/> <!--依赖的类库--> <path id="lib.third_party"> <fileset dir="${lib.runtime}"> <include name="*.jar"/> </fileset> <fileset dir="${lib.provided}"> <include name="*.jar"/> </fileset> </path> <!-- 初始化,建立需要生成的路径 --> <target name="init" description="初始化"> <tstamp> <format property="DSTAMP" pattern="yyyy-MM-dd"/> <format property="TSTAMP" pattern="HH:mm:ss"/> </tstamp> <echo>########################################</echo> <echo message="### 开始构建 ${build.war.name} at ${DSTAMP} ${TSTAMP} ###"></echo> <echo>########################################</echo> <mkdir dir="${output.class.dir}"/> </target> <!-- 清理 --> <target name="clean" description="清理"> <delete dir="${output.class.dir}"/> <delete dir="${build.root.dir}"/> </target> <!-- 编译 src --> <target name="compile" depends="init" description="编译"> <javac srcdir="${src.dir}" fork="true" destdir="${output.class.dir}" debug="${compiler.debug}" compiler="${compiler.type}" optimize="${compiler.optimize}" deprecation="${compiler.deprecation}" verbose="${compiler.verbose}" encoding="${compiler.encoding}" nowarn="${compiler.nowarn}" failonerror="${compiler.failonerror}" > <classpath refid="lib.third_party"/> </javac> <copy todir="${output.class.dir}" preservelastmodified="false"> <fileset dir="${src.dir}/" includes="**/*.*" excludes="**/_svn/**, **/.svn/**, **/*.zh, **/*.en, **/*.java, **/*.bak"> </fileset> <fileset dir="${res.dir}/" includes="**/*.*" excludes="**/_svn/**, **/.svn/**, **/*.bat"> </fileset> </copy> </target> <!-- 打包war --> <target name="war" depends="clean, init, compile" description="打包war"> <delete file="${build.root.dir}/${build.war.name}" failonerror="false"/> <delete dir="${build.war.dir}" failonerror="false"/> <!-- 拷贝webapp目录 --> <copy todir="${build.war.dir}" includeemptydirs="true"> <fileset dir="${webapp.dir}" includes="**/*.*" excludes="**/_svn/**, **/.svn/**"/> </copy> <!-- 拷贝classes目录 --> <mkdir dir="${build.war.dir}/WEB-INF/classes"/> <copy todir="${build.war.dir}/WEB-INF/classes"> <fileset dir="${output.class.dir}" includes="**/*.*"/> </copy> <!-- 拷贝lib目录 --> <!-- <mkdir dir="${build.war.dir}/WEB-INF/lib"/> <copy todir="${build.war.dir}/WEB-INF/lib"> <fileset dir="${lib.runtime}" includes="*.jar"/> </copy> --> <war destfile="${build.root.dir}/${build.war.name}" webxml="${webapp.dir}/WEB-INF/web.xml"> <fileset dir="${build.war.dir}" includes="**/*.*"/> </war> <echo>构建 ${build.war.name} 完成 at ${DSTAMP} ${TSTAMP}</echo> </target> </project>

你可能感兴趣的:(File,delete,include,compiler,webapp,encoding)