使用ant进行web打包

编程入门 行业动态 更新时间:2024-10-15 18:23:48

使用<a href=https://www.elefans.com/category/jswz/34/1754493.html style=ant进行web打包"/>

使用ant进行web打包

今天学习了使用ant进行打包,记录如下:

<project name="platform-war" default="release" basedir="."><property file="${resource.home}/database.conf.properties" /><!-- ==================== File and Directory Names ======================== --><property name="build.home" value="${basedir}/target/build" /><property name="dist.home" value="${basedir}/target/dist" /><property name="deploy.path" value="${dist.home}/platform" /><property name="src.home" value="${basedir}/src/main/java" /><property name="resource.home" value="${basedir}/src/main/resources" /><property name="web.home" value="${basedir}/src/main/webapp" /><property name="libpile.home" value="${basedir}/antlib" /><property name="lib.runtime.home" value="${web.home}/WEB-INF/lib" /><tstamp prefix="build"><format property="dt" pattern="yyyyMMdd.HHmmss.SSS" /></tstamp><tstamp><format property="deploy.debug.tstamp" pattern="yyyy-MM-dd HH:mm:ss" /></tstamp><echo>开始打包:${deploy.debug.tstamp}</echo><path id="compile.web.classpath"><fileset dir="${libpile.home}"><include name="*.jar" /></fileset><fileset dir="${lib.runtime.home}"><include name="*.jar" /></fileset></path><target name="-clean-compile" description="清除编译过的文件和发布的文件"><delete dir="${build.home}" /><delete dir="${dist.home}" /></target><target name="clean" depends="-clean-compile" description="深层清除发布环境,删除所有预编译文件,以重新编译所有Java类和重新复制所有文件"></target><target name="-prepare" description="为发布工作进行准备"><mkdir dir="${build.home}/java" /><mkdir dir="${build.home}/classes" /><mkdir dir="${dist.home}" /></target><target name="-compile" depends="-prepare" description=""><tstamp><format property="deploy.debug.tstampcompile" pattern="yyyy-MM-dd HH:mm:ss" /></tstamp><echo>开始正在编译java:${deploy.debug.tstampcompile}</echo><copy todir="${build.home}/java" preservelastmodified="true" encoding="UTF-8" outputencoding="UTF-8"><fileset dir="${src.home}"><include name="**/*.java" /><exclude name="**/CVS/" /><exclude name="**/SVN/" /></fileset></copy><javac srcdir="${build.home}/java" destdir="${build.home}/classes" nowarn="true" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="UTF-8" source="1.7" target="1.7"><classpath refid="compile.web.classpath" /></javac></target><target name="compile" depends="-compile" description="编译需要的Java类(增量),并直接将编译后的结果复制(仅更新文件)到发布路径"></target><target name="copy-web" description="发布Web内容到发布目录(仅更新文件)"><tstamp><format property="deploy.debug.tstampcopyweb" pattern="yyyy-MM-dd HH:mm:ss" /></tstamp><echo>开始copyweb:${deploy.debug.tstampcopyweb}</echo><copy todir="${deploy.path}" preservelastmodified="true"><fileset dir="${web.home}"></fileset></copy><copy todir="${deploy.path}/WEB-INF/classes" includeEmptyDirs="false"><fileset dir="${build.home}/classes"></fileset><fileset dir="${resource.home}"></fileset></copy></target><target name="release" depends="-clean-compile,-prepare,compile,copy-web" description="打包成war"><tstamp><format property="deploy.debug.tstamprelease" pattern="yyyy-MM-dd HH:mm:ss" /></tstamp><echo>开始打包war:${deploy.debug.tstamprelease}</echo><war destfile="${dist.home}/platform.war"><fileset dir="${dist.home}/platform"></fileset></war><tstamp><format property="deploy.debug.tstampover" pattern="yyyy-MM-dd HH:mm:ss" /></tstamp><echo>结束打包:${deploy.debug.tstampover}</echo></target>
</project>


 


更多推荐

使用ant进行web打包

本文发布于:2024-03-23 14:56:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1739494.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ant   web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!