<!--编译web项目,部署到tomcat容器中-->
<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="dist" basedir=".">
<property name="jdk_home" value="C:\Program Files\Java\jre6" />
<property name="appName" value="fcktest"/>
<property name="tomcathome.dir" value="D:\tomcat6.0.14\"/>
<property name="src.dir" value="./src"/>
<property name="lib.dir" value="WebRoot/WEB-INF/lib"/>
<property name="dist.dir" value="dist"/>
<property name="classes.dir" value="WebRoot/WEB-INF/classes"/>
<property name="webapps.dir" value="${tomcathome.dir}webapps\ROOT"/>
<property name="webroot.dir" value="WebRoot"/>
<property name="config.dir" value="src"/>
<property name="report" value="e:/report"/>
<path id="compile.classpath">
<pathelement location="${classes.dir}"/>
<fileset dir="${jdk_home}\lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcathome.dir}lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<target name="clean" description="Delete old build and dist directories">
<delete dir="${dist.dir}"/>
<!--
<delete dir="${clesses.dir}"/>
<delete dir="${webapps.dir}"/>
-->
</target>
<target name="prepare">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compile java sources">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" fork="yes"
executable="${jdk_home}\bin\javac"
compiler="javac1.6">
<compilerarg line="-encoding UTF-8 "/>
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.xml"/>
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<target name="deploy" depends="compile" description="Deploy application to servlet container">
<mkdir dir="${webapps.dir}"/>
<copy todir="${webapps.dir}">
<fileset dir="${webroot.dir}"/>
</copy>
<mkdir dir="${webapps.dir}/WEB-INF/classes"/>
<copy todir="${webapps.dir}/WEB-INF/classes">
<fileset dir="${classes.dir}" >
<include name="**/**" />
</fileset>
</copy>
<mkdir dir="${webapps.dir}/WEB-INF/lib"/>
<copy todir="${webapps.dir}/WEB-INF/lib">
<fileset dir="${lib.dir}" includes="*.jar" />
</copy>
</target>
<target name="dist" depends="clean,deploy" description="Create binary destribution">
<jar jarfile="${dist.dir}/${appName}.war" basedir="${webapps.dir}"/>
</target>
<target name="junitreport" depends="clean, compile">
<mkdir dir="${report}"/>
<junit printsummary="on"
fork="true"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath refid="compile.classpath"/>
<formatter type="xml"/>
<batchtest todir="${report}">
<fileset dir="./src/">
<include name="**/*Case.*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${report}">
<fileset dir="${report}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${report}"/>
</junitreport>
<fail if="tests.failed">
---------------------------------------------------------
One or more tests failed, check the report for detail...
---------------------------------------------------------
</fail>
</target>
</project>
<!--依次启动多个ant文件(进入某一个目录的情况下启动)-->
<?xml version="1.0"?>
<project name="sdop" default="paserver">
<target name="pre">
<ant dir="../Transform/">
</ant>
</target>
<target name="bppl" depends="pre">
<ant dir="../Bppl/">
</ant>
</target>
<target name="dispatcher" depends="bppl">
<ant dir="../Dispatch/">
</ant>
</target>
<target name="paserver" depends="dispatcher">
<ant dir="../Paserver/">
</ant>
</target>
</project>
<!--对某一个目录打jar包,并带上启动函数-->
<?xml version="1.0"?>
<project name="paserver" default="release">
<property name="class.dir" value="./class" />
<property name="dist.dir" value="../dist_sdop/lib" />
<property name="jar.file" value="./lib/paserver.jar" />
<property name="src.dir" value="./src" />
<property name="dist.config.dir" value="../dist_sdop/config" />
<property name="lib.dir" value="./lib" />
<property name="main-class" value="cn.my.pas.test.StartSdop" />
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${dist.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${class.dir}" />
</target>
<target name="init" depends="clean">
<mkdir dir="${lib.dir}" />
<mkdir dir="${class.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.config.dir}" />
</target>
<target name="compile" depends="init">
<javac destdir="${class.dir}" source="1.6" target="1.6" debug="true" deprecation="false" optimize="false" failοnerrοr="true" encoding="UTF-8">
<src path="${src.dir}" />
<classpath refid="project.classpath" />
</javac>
</target>
<target name="jar" depends="compile">
<pathconvert property="libs.project" pathsep=" ">
<mapper>
<chainedmapper>
<flattenmapper />
</chainedmapper>
</mapper>
<path>
<fileset dir="${dist.dir}">
<include name="**/*.jar" />
</fileset>
</path>
</pathconvert>
<jar basedir="${class.dir}" destfile="${jar.file}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Built-By" value="liubing@shopex.cn" />
<attribute name="Class-Path" value="${libs.project}" />
</manifest>
</jar>
<delete dir="${class.dir}" />
</target>
<target name="release" depends="jar">
<copy todir="${dist.config.dir}">
<fileset dir="${src.dir}">
<include name="**/*.xml" />
<include name="**/*.properties" />
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</copy>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="dist" basedir=".">
<property name="jdk_home" value="C:\Program Files\Java\jre6" />
<property name="appName" value="fcktest"/>
<property name="tomcathome.dir" value="D:\tomcat6.0.14\"/>
<property name="src.dir" value="./src"/>
<property name="lib.dir" value="WebRoot/WEB-INF/lib"/>
<property name="dist.dir" value="dist"/>
<property name="classes.dir" value="WebRoot/WEB-INF/classes"/>
<property name="webapps.dir" value="${tomcathome.dir}webapps\ROOT"/>
<property name="webroot.dir" value="WebRoot"/>
<property name="config.dir" value="src"/>
<property name="report" value="e:/report"/>
<path id="compile.classpath">
<pathelement location="${classes.dir}"/>
<fileset dir="${jdk_home}\lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcathome.dir}lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<target name="clean" description="Delete old build and dist directories">
<delete dir="${dist.dir}"/>
<!--
<delete dir="${clesses.dir}"/>
<delete dir="${webapps.dir}"/>
-->
</target>
<target name="prepare">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compile java sources">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" fork="yes"
executable="${jdk_home}\bin\javac"
compiler="javac1.6">
<compilerarg line="-encoding UTF-8 "/>
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.xml"/>
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<target name="deploy" depends="compile" description="Deploy application to servlet container">
<mkdir dir="${webapps.dir}"/>
<copy todir="${webapps.dir}">
<fileset dir="${webroot.dir}"/>
</copy>
<mkdir dir="${webapps.dir}/WEB-INF/classes"/>
<copy todir="${webapps.dir}/WEB-INF/classes">
<fileset dir="${classes.dir}" >
<include name="**/**" />
</fileset>
</copy>
<mkdir dir="${webapps.dir}/WEB-INF/lib"/>
<copy todir="${webapps.dir}/WEB-INF/lib">
<fileset dir="${lib.dir}" includes="*.jar" />
</copy>
</target>
<target name="dist" depends="clean,deploy" description="Create binary destribution">
<jar jarfile="${dist.dir}/${appName}.war" basedir="${webapps.dir}"/>
</target>
<target name="junitreport" depends="clean, compile">
<mkdir dir="${report}"/>
<junit printsummary="on"
fork="true"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath refid="compile.classpath"/>
<formatter type="xml"/>
<batchtest todir="${report}">
<fileset dir="./src/">
<include name="**/*Case.*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${report}">
<fileset dir="${report}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${report}"/>
</junitreport>
<fail if="tests.failed">
---------------------------------------------------------
One or more tests failed, check the report for detail...
---------------------------------------------------------
</fail>
</target>
</project>
<!--依次启动多个ant文件(进入某一个目录的情况下启动)-->
<?xml version="1.0"?>
<project name="sdop" default="paserver">
<target name="pre">
<ant dir="../Transform/">
</ant>
</target>
<target name="bppl" depends="pre">
<ant dir="../Bppl/">
</ant>
</target>
<target name="dispatcher" depends="bppl">
<ant dir="../Dispatch/">
</ant>
</target>
<target name="paserver" depends="dispatcher">
<ant dir="../Paserver/">
</ant>
</target>
</project>
<!--对某一个目录打jar包,并带上启动函数-->
<?xml version="1.0"?>
<project name="paserver" default="release">
<property name="class.dir" value="./class" />
<property name="dist.dir" value="../dist_sdop/lib" />
<property name="jar.file" value="./lib/paserver.jar" />
<property name="src.dir" value="./src" />
<property name="dist.config.dir" value="../dist_sdop/config" />
<property name="lib.dir" value="./lib" />
<property name="main-class" value="cn.my.pas.test.StartSdop" />
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${dist.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${class.dir}" />
</target>
<target name="init" depends="clean">
<mkdir dir="${lib.dir}" />
<mkdir dir="${class.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.config.dir}" />
</target>
<target name="compile" depends="init">
<javac destdir="${class.dir}" source="1.6" target="1.6" debug="true" deprecation="false" optimize="false" failοnerrοr="true" encoding="UTF-8">
<src path="${src.dir}" />
<classpath refid="project.classpath" />
</javac>
</target>
<target name="jar" depends="compile">
<pathconvert property="libs.project" pathsep=" ">
<mapper>
<chainedmapper>
<flattenmapper />
</chainedmapper>
</mapper>
<path>
<fileset dir="${dist.dir}">
<include name="**/*.jar" />
</fileset>
</path>
</pathconvert>
<jar basedir="${class.dir}" destfile="${jar.file}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Built-By" value="liubing@shopex.cn" />
<attribute name="Class-Path" value="${libs.project}" />
</manifest>
</jar>
<delete dir="${class.dir}" />
</target>
<target name="release" depends="jar">
<copy todir="${dist.config.dir}">
<fileset dir="${src.dir}">
<include name="**/*.xml" />
<include name="**/*.properties" />
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</copy>
</target>
</project>