Apache Ant 工具
<copy todir="${build}/WEB-INF/classes"><fileset dir="${build}/server" />
</copy>
<copy file="web/web.xml" todir="${build}/WEB-INF" />
<copy todir="${build-path}">
<fileset dir="web">
<include name="*.html" />
<include name="*.jpg" />
<include name="*.jsp" />
</fileset>
</copy>
<delete dir="${build.dir}" failonerror="false"/>
<mkdir dir="${build.dir}"/>
<!-- 设置环境变量 -->
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="lib/helper.jar"/>
</classpath>
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
</classpath>
<path id="classpath">
<fileset dir="${tomcat.jwsdp.home}/common/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${jwsdp.home}/jaxm1.1.2/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${jwsdp.home}/saaj/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${jwsdp.home}/jwsdp-shared/lib">
<include name="*.jar" />
</fileset>
</path>
<target name="compile-server" depends="prepare" description="Compiles the server-side source code">
<echo message="正在编译服务器端源代码...." />
<javac srcdir="${src}" destdir="${build}/server" includes="PriceListServlet.java, ConfirmationServlet.java">
<classpath refid="classpath" />
</javac>
</target>
<javac
srcdir="${src}"
destdir="${build}/registry"
classpath="${jwsdp-jars}"
includes="JAXR*.java,Org*.java"
/>
<java classname="JAXRQueryByName" fork="yes">
<!--<sysproperty key="org.apache.commons.logging.log"
value="org.apache.commons.logging.impl.SimpleLog"/>
<sysproperty key="org.apache.commons.logging.implelog.defaultlog"
value="debug"/>
<sysproperty key="org.apache.commons.logging.impl.simplelog.log.com.sun.xml.registry_server"
value="debug"/>-->
<!--<sysproperty key="proxySet" value="true"/>
<sysproperty key="http.proxyHost" value="webcache.east.sun.com "/>
<sysproperty key="http.proxyPort" value="8080"/>-->
<arg line="${query-string}" />
<classpath refid="classpath" />
<classpath path="${build-path}/WEB-INF/classes" />
</java>
<target name="javadocs"
depends="jars"
description="-- creates the API documentation">
<!--copy docs 手册... -->
<copy todir="${build.docs"}
<fileset dir="${docs.dir}"/>
</copy>
<javadoc packagenames="hello.ant"
sourcepath="${src.main}"
defaultexcludes="yes"
destdir="${build.docs.api}"
author="true"
version="true"
use="true"
windowtitle="Docs API"
doctitle!]doctitle
bottom!]bottom>
<tag name="todo" scope="all" description="To do"/>
</javadoc>
</target>
<!-- 打包客户端 .jar -->
<target name="jar-client" depends="compile-client" description="Builds the JAR file that contains the JAX-M client routines">
<echo message="正在打包客户端 .jar ${client-jar} file...." />
<delete file="dist/${client-jar}" />
<jar jarfile="dist/${client-jar}">
<fileset dir="${build}/client">
<exclude name="**/*Test*" />
</fileset>
</jar>
</target>
<!-- Native2Ascii任务 进行批量转码 -->
<native2ascii encoding="GBK" src="${src}" dest="${dest}"/>
<-- 测试 -->
<arget name="test" depends="compile" description="run junit test">
<kdir dir="${report.dir}"/>
<unit printsummary="on"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<lasspath refid="master-classpath" />
<ormatter type="plain"/>
<atchtest todir="${report.dir}">
<ileset dir="${classes.dir}">
<nclude name="**/*Test.*"/>
<fileset>
<batchtest>
<junit>
<ail if="tests.failed">
***********************************************************
**** One or more tests failed! Check the output ... ****
***********************************************************
<fail>
<target>
<target name="set-wscompile"
description="Sets the value of the ${wscompile} property" >
<condition property="script-suffix" value="bat">
<os family="windows"/>
</condition>
<condition property="script-suffix" value="sh">
<not>
<os family="windows"/>
</not>
</condition>
<property name="wscompile" value="${jaxrpc.home}/bin/wscompile.${script-suffix}"/>
</target>
<!-- run-test-order -->
<target name="run-test-order">
<antcall target="run-test-client">
<param name="client-class" value="jaxm.src.TestOrderRequest" />
</antcall>
</target>
<!-- run-test-price -->
<target name="run-test-price">
<antcall target="run-test-client">
<param name="client-class" value="jaxm.src.TestPriceListRequest" />
</antcall>
</target>
<!-- run-test-client -->
<target name="run-test-client" description="Runs a test client">
<echo message="Running the ${client-class} program:" />
<echo message=" " />
<java fork="on" classname="${client-class}">
<classpath refid="classpath" />
<classpath path="${build}/client" />
</java>
=====================================================
<!-- 部署相关 -->
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" />
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask" />
<taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask" />
<taskdef name="list" classname="org.apache.catalina.ant.ListTask" />
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" />
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" />
<!-- 配置WEB-INF目录信息 -->
<target name="setup-web-inf" description="Copies files to build/WEB-INF">
<echo message="正在配置 ${build}/WEB-INF...." />
<delete dir="${build}/WEB-INF" />
<mkdir dir="${build}/WEB-INF/classes" />
<copy todir="${build}/WEB-INF/classes">
<fileset dir="${build}/server" />
</copy>
<copy file="web/web.xml" todir="${build}/WEB-INF" />
</target>
<!-- package .war -->
<target name="package" depends="build" description="Packages the WAR file">
<echo message="Packageing the .war ...." />
<delete file="dist/${war-file}" />
<jar jarfile="dist/${war-file}">
<fileset dir="${build-path}" includes="WEB-INF/**" />
</jar>
</target>
<!-- install -->
<target name="install" depends="build" description="Installs a Web application">
<echo message="Installing the application...." />
<install url="${url}" username="${username}" password="${password}" path="/${context-path}" war="file:${build-path}" />
</target>
<!-- deploy -->
<target name="deploy" depends="build, package" description="Deploys a Web application">
<echo message="Deploying the application...." />
<deploy url="${url}" username="${username}" password="${password}" path="/${context-path}" war="file:${example-path}/dist/${war-file}" />
</target>
<!-- undeploy -->
<target name="undeploy" description="Undeploys a Web application">
<echo message="Undeploying the application...." />
<undeploy url="${url}" username="${username}" password="${password}" path="/${context-path}" />
</target>
<!-- list -->
<target name="list" description="Lists a Web application">
<echo message="Listing the application...." />
<list url="${url}" username="${username}" password="${password}" />
</target>
<!-- remove -->
<target name="remove" description="Removes a Web application">
<echo message="Removing the application...." />
<remove url="${url}" username="${username}" password="${password}" path="/${context-path}" />
</target>
<!-- reload -->
<target name="reload" depends="setup-web-inf" description="Reloads a Web application">
<echo message="Reloading the application...." />
<reload url="${url}" username="${username}" password="${password}" path="/${context-path}" />
</target>
<target name="install"
description="Installs a Web application">
<echo message="Installing the application...."/>
<install
url="${url}"
username="${username}"
password="${password}"
path="/${context.path}"
war="file:${build.path}"
/>
</target>
<target name="deploy" depends="build, package"
description="Deploys a Web application">
<echo message="Deploying the application...."/>
<deploy
url="${url}"
username="${username}"
password="${password}"
path="/${context.path}"
war="file:${example.path}/dist/${war.file}"
/>
</target>
<target name="undeploy"
description="Undeploys a Web application">
<echo message="Undeploying the application...."/>
<undeploy
url="${url}"
username="${username}"
password="${password}"
path="/${context.path}"
/>
</target>
<target name="list"
description="Lists a Web application">
<echo message="Listing the application...."/>
<list
url="${url}"
username="${username}"
password="${password}"
/>
</target>
<target name="remove"
description="Removes a Web application">
<echo message="Removing the application...."/>
<remove
url="${url}"
username="${username}"
password="${password}"
path="/${context.path}"
/>
</target>
<target name="reload" depends="copy-to-web-inf"
description="Reloads a Web application">
<echo message="Reloading the application...."/>
<reload
url="${url}"
username="${username}"
password="${password}"
path="/${context.path}"
/>
</target>
=====================================================
<target name="checkout">
<property file="TestWeb.properties" />
<cvs cvsRoot="${cvs.root}" package="${cvs.projectName}"
tag="${cvs.tag}" dest="${src.dir}" failonerror="true" />
</target>
base.dir=c:/temp/
src.dir=${base.dir}/src
cvs.server=cvs.server
cvs.user=username
cvs.pw=pwd
cvs.repositoryPath=/home/testPath
cvs.projectName=TestProj
cvs.root=:pserver:${cvs.user}:${cvs.pw}@${cvs.server}:${cvs.repositoryPath}
cvs.tag=
页:
[1]