Ant 的常用方法例子

Ant的常用方法例子

 

1.       javac

 

<path id="base.path">

      <pathelement location="${lib.dir}/log4j-1.2.16.jar" />

</path>

<target name="complie"depends="clean">

      <javac srcdir="${src.dir}" destdir="${dest.dir}" classpathref="base.path"includeantruntime="on"/>

      <echo message="complie source successfully." />

</target>


 

2.      Delete, mkdir, and echo

<target name="clean" >

                <delete dir="${dest.dir}" />

                <delete file="${lib.dir}/safx.jar" />

                <mkdir dir="${dest.dir}" />

                <echo message="clean and remake classes dir successfully." />

</target>


 

3.      Copy

 

<target name="copylog4j"depends="complie">

      <copy todir="${dest.dir}">

            <fileset dir="${src.dir}">

                   <includename="log4j.properties" />           

        </fileset>

        </copy>

        <echo message="copylog4j.properties file successfully." />

</target>


4.      Jar

<target name="jar"depends="copylog4j">

          <jar destfile="${lib.dir}/safx.jar" basedir="${dest.dir}" />

          <delete dir="${dest.dir}" />

</target>

 

5.      Zip

<target name="zip">

           <echomessage="zip start..." />

           <copy todir="D:/picture">

           	<fileset dir="${dir.output}"includes="${dir.screenshot}/*.png" />

       	   </copy>

           <copy file="log4j_file.html"tofile="${dir.output}/log4j_file.html" />

           <zip destfile="${dir.report}/${CREATE_TIME}_${global.browser}_${global.version}.zip"basedir="${dir.output}" includes="*.html"excludes="${dir.screenshot}/*.png" update="true" />

           <zipd estfile="${dir.report}/${CREATE_TIME}_${global.browser}_${global.version}_${dir.screenshot}.zip"basedir="${dir.output}" excludes="*.html"includes="${dir.screenshot}/*.png" update="true" />

            <echo message="zip end..." />
 </target>

 

6.      Email

          

 <targetname="email">

         <echo message="email start..." />

         <mail mailhost="${mail.host}" mailport="${mail.port}"subject="${CREATE_TIME} The ${global.version} build has completed"ssl="on" charset="utf-8" user="${mail.user}"password="${mail.password}" messagemimetype="text/html">

               <from address="${mail.user}" />

               <message>The${global.version} build has completed.</message>

                                                
               <to address="caiqcong@126.com" />

                                                
               <fileset dir="${dir.report}">

                                                                
                     <includename="${CREATE_TIME}_${global.browser}_${global.version}.zip" />

                                                                
                </fileset>

          </mail>

          <echomessage="email end..." />

 </target>


7.      SVNcheckout

<target name="svn.checkout" depends="svn.checkout.prepare">

          <echo message="svn.checkout start..." />

          <!--svn account and password -->

          <svn javahl="true" username="${svn.username}"password="${svn.password}">

                <!--SVN server URL -->

                <checkouturl="${svn.url}/account" destPath="account"revision="HEAD" />

                <checkouturl="${svn.url}/email" destPath="email"revision="HEAD" />

                <checkouturl="${svn.url}/import" destPath="import"revision="HEAD" />

                                               
                <checkouturl="${svn.url}/${svn.dir.schema}"destPath="${svn.dir.schema}" revision="HEAD" />

                <checkouturl="${svn.url}/${svn.dir.testCase}/${global.version}"destPath="${svn.dir.testCase}/${global.version}"revision="HEAD" />

                <checkouturl="${svn.url}/${svn.dir.webSite}/2.0.24"destPath="${svn.dir.webSite}/2.0.24" revision="HEAD" />

           </svn>

           <echomessage="svn.checkout end..." />

 </target>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值