我自己写的一个Ant通用模板build.xml
这个模板应用于Web系统
<?xml version="1.0" encoding="UTF-8"?>
<project name="Push_Demo" basedir="." default="">
<!-- project properties -->
<property name="pro.name" value="push" />
<property name="pro.dir" value="." />
<!-- tomcat properties -->
<property name="tomcat.home" value="/green/apache-tomcat-6.0.14" />
<property name="tomcat.lib" value="${tomcat.home}/lib" />
<!-- dirctionary properties -->
<property name="src.dir" value="src" />
<property name="web.dir" value="WebRoot" />
<property name="lib.dir" value="${web.dir}\WEB-INF\lib" />
<property name="classes.dir" value="${web.dir}\WEB-INF\classes" />
<property name="deploy.dir" value="${tomcat.home}\webapps\${pro.name}" />
<!-- lib properties -->
<path id="compile.lib">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${tomcat.lib}">
<include name="*.jar" />
</fileset>
</path>
<!-- -->
<target name="compile.mkdir">
<mkdir dir="${classes.dir}" />
</target>
<!-- -->
<target name="compile.rmdir">
<delete dir="${classes.dir}" />
</target>
<!-- initialize deploy directory -->
<target name="deploy.init">
<delete dir="${deploy.dir}" />
<mkdir dir="${deploy.dir}" />
</target>
<!-- compile java source files -->
<target name="compile">
<echo>compiling the java code</echo>
<javac srcdir="${src.dir}" destdir="${classes.dir}" encoding="UTF-8"
debug="on">
<classpath refid="compile.lib" />
</javac>
</target>
<target name="build.copy" depends="compile">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="deploy.copy">
<copy todir="${deploy.dir}">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="build" depends="compile,build.copy" />
<target name="rebuild" depends="compile.rmdir,compile.mkdir,build" />
<target name="deploy" depends="build,deploy.copy" />
<target name="redeploy" depends="deploy.init,deploy" />
</project>
|----------------------------------------------------------------------------------------|
版权声明 版权所有 @zhyiwww
引用请注明来源 http://www.blogjava.net/zhyiwww
|----------------------------------------------------------------------------------------|