`
xiaocao000
  • 浏览: 223775 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

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![CDATA[h1hello ant Docs APIh1]]doctitle
             bottom![CDATA[i${app.copyright}i]]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=
分享到:
评论

相关推荐

    Apache Ant 教程 - 极客学院

    Ant 是一个 Apache 基金会下的跨平台的基于 Java 语言开发的构件工具。在我们详细了解 Apache Ant 之前, 让我们来讲解为什么构建工具是需要最先了解的。

    Apache Ant_1.6.5 API

    Apache公司的Ant工具,它也有自己的API,这里将详细介绍

    Apache Ant权威指南

    Apache Ant,是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发。 j2sdk1.5.0_03就是老版本的jdk.现在已经出到最新的7.0了。 本书为PDF格式 谢谢支持

    apache-ant-1.9.6

    Apache Ant安装与配置 一、解压ant安装包在D:\SWE下 二、环境变量配置 ANT_HOME D:\SWE\apache-ant-1.8.4 CLASSPATH ;%ANT_HOME%lib; PATH ;%ANT_HOME%bin; 三、测试是否安装成功 在cmd命令方式下输入:ant -version

    Apache Ant 实例介绍

    NULL 博文链接:https://cuics-100.iteye.com/blog/909448

    Apache Ant入门教程

    Apache Ant 是一个基于 Java 的生成工具。据最初的创始人 James Duncan Davidson 介绍,这个工具的名称是 another neat tool(另一个整洁的工具) 的首字母缩写。 生成工具在软件开发中用来将源代码和其他输入文件...

    Apache Ant常用标签介绍

    NULL 博文链接:https://cuics-100.iteye.com/blog/911416

    apache-ant-1.9.10-bin.zip

    Apache Ant,是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发。

    apache-ant-1.10.13-bin

    Apache Ant是一个由Apache软件基金会提供的Java库与命令行工具,主要用于自动化软件编译、测试、部署等步骤,尤其在Java环境中的软件开发中广泛应用。其配置文件以XML格式编写,易于维护和书写,结构清晰。 Apache ...

    apache-ant 1.9.9 1.10.10 windows+linux包

    Apache Ant,是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发。由Apache软件基金会所提供。

    apache-ant-1.9.9-bin.tar.bz2

    Apache Ant,是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发。由Apache软件基金会所提供。

    apache-ant-1.7.0

    apache-ant-1.7.0 工具,编译打包工具

    apache-ant-1.7.1

    apache-ant-1.7.1工具 配置环境变量ANT_HOME 值解压的目录 path %ANT_HOME%\bin

    apache-ant工具

    ant工具,亲测可以用

    apache-ant-1.10.1

    apache-ant-1.10.1 jre环境至少1.8以上 Ant是一个Apache基金会下的跨平台的构件工具

    apache-ant1.8.2

    ant是一个很好地管理工具,可以有效的帮助我们管理工程。 这是一个ant1.8.0版本的包

    apache-ant-1.7.1-bin

    ant工具包,从apache官方网站下载来的 ant工具包,从apache官方网站下载来的

    apache-ant-1.8.0

    ant 工具包,直接解压即可使用。 系统变量中配置ANT_HOME:D:\apache-ant-1.8.0, PATH:%ANT_HOME%\bin; 配置好,打开cmd,进入项目目录运行ant命令即可。

Global site tag (gtag.js) - Google Analytics