首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

web应用开发简略的ANT构建文件

2013-10-23 
web应用开发简单的ANT构建文件project namefirst_spring_ws basedir. defaultjunitproperty n

web应用开发简单的ANT构建文件
<project name="first_spring_ws" basedir="." default="junit">

<property name="tomcat.lib" value="E:/Tomcat 6.0/lib" />
<property name="src" value="${basedir}/src" />
<property name="build" value="${basedir}/build" />
<property name="webRoot" value="${basedir}/WebRoot" />
<property name="lib" value="${webRoot}/WEB-INF/lib" />
<property name="build.class" value="${build}/classes" />
<property name="project.name" value="first_spring_ws" />
<property name="test.src" value="${basedir}/test" />
<property name="test.report" value="${basedir}/report" />

<path id="class_path">
<fileset dir="${tomcat.lib}">
<include name="**.jar"/>
</fileset>
<fileset dir="${lib}">
<include name="**.jar" />
</fileset>
   </path>


<target name="clean" description="删除目录">
<echo message="删除目录"></echo>
<delete dir="${build}"></delete>
<delete dir="${test.report}"/>
</target>

<target name="init" description="创建目录" depends="clean">
<echo message="创建目录-执行"></echo>
<mkdir dir="${build.class}"/>
<mkdir dir="${test.report}"/>
<mkdir dir="${test.report}/framework-${DSTAMP}-${TSTAMP}"/>

</target>

<target name="compile" description="编译文件" depends="init">
<echo message="编译文件"></echo>
<javac srcdir="${src}" destdir="${build.class}">
<classpath refid="class_path" />
<compilerarg line="-encoding GBK"/>

</javac>

<copy todir="${build.class}">
<fileset dir="${src}">
<include name="*.xml"/>
<include name="*.properties"/>
</fileset>
</copy>

<javac srcdir="${test.src}" destdir="${build.class}">
<classpath refid="class_path" />
<compilerarg line="-encoding GBK"/>
</javac>
</target>

<target name="war" depends="compile">
<echo message="打成war包"></echo>
<war destfile="${build}/${project.name}.war" webxml="${webRoot}/WEB-INF/web.xml">
<fileset dir="${webRoot}" />
<lib dir="${lib}" />
<classes dir="${build.class}" />
</war>
</target>

<path id="junit_path" >
<path refid="class_path"></path>
<pathelement location="${build.class}"/>

</path>

<target name="junit" depends="compile">

<echo message="单元测试"></echo>

<junit printsummary="true">

<classpath refid="junit_path">
</classpath>

<formatter type="plain"/>

<batchtest fork="yes" todir="${test.report}/framework-${DSTAMP}-${TSTAMP}">
<fileset dir="${test.src}">
<include name="**/*Driver.java"/>
</fileset>
</batchtest>
</junit>

</target>
</project>

热点排行