读书人

ant 根本配置

发布时间: 2012-12-21 12:03:49 作者: rapoo

ant 基本配置

ant 基本配置

?

<!--最外层标签 name: 名字 ,default: 执行入口(指定执行哪个target,执行顺序与编码顺序无关),basedir: 路径设置(.代表当前路径)--><project name="MessageGateway_case" default="deploy" basedir=".">        <!-- 载入文件-->        <property file="build.properties" />        <!--定义变量-->        <property name="app.home" value="." />        <!--app.home 为bulid.properties 中的属性-->        <property name="src.home" value="${app.home}/src">        <!-- 设置路径-->        <path id="compile.classpath">                <!-- 设置过虑条件-->                <fileset dir="${app.home}/editorLib">                        <!-- 包含的文件-->                        <include name="*.jar" />                </fileset>        </path>        <target name="init.propfiles">                 <!--检查验证文件-->                 <condition property="properties.ok">                       <and>                            <available file="build.properties" />                       </and>                  </condition>                  <fail unless="properties.ok">                            build.properties is missing, please make sure that you had done setenv already.                  </fail>        </target>        <!-- depends 等init.propfiles 执行之后在执行 -->        <target name="prepare" depends="init.propfiles">                <!-- 创建文件夹-->                <mkdir dir="${build.home}" />        </target>        <target name="compile" depends="prepare"><tstamp />                     <!--编译代码-->     <javac srcdir="${src.home}" destdir="${build.class}" debug="yes">    <classpath refid="compile.classpath">   </classpath>     </javac>      </target>        <target name="bind" depends="compile">                    <--  jibx 由xml 生成 java对像-->    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">   <classpath refid="compile.classpath">   </classpath>    </taskdef>    <bind binding="${bind.xml}">    <classpath>   <pathelement location="${build.class}" />    </classpath>    </bind>        </target>         <target name="build" depends="bind">             <!--把所有配置文件转成unicode编码-->             <native2ascii src="${src.home}" dest="${build.home}/${app.name}/WEB-INF/classes" includes="*.*" />        </target><target name="deploy" depends="build">                <!--最后发布文件--><copy todir="${deploy.home}"><fileset dir="${build.home}/${app.home}" /></copy></target></project>

读书人网 >编程

热点推荐