Joinclass Inc  
软件开发 软件配置 项目管理 软件工程
公告
  • 本人联系方式: E-mail: tilanmaster@gmail.com msm: J.joy@msn.com
日历
统计
  • 随笔 - 53
  • 文章 - 52
  • 评论 - 67
  • 引用 - 0

导航

常用链接

留言簿(1)

随笔分类(53)

随笔档案(53)

文章分类(61)

相册

JAVA学习链接

搜索

  •  

积分与排名

  • 积分 - 88522
  • 排名 - 77

最新评论

阅读排行榜

评论排行榜

 

实现的主要功能是:自动从cvs中check out模块,然后编译,把编译后的class打成jar,再commit到cvs服务器的指定位置。
build.xml

代码
  1. <? xml   version = "1.0" ?>   
  2. < project   name = "gnt Auto build"   basedir = "."   default = "build" >   
  3.   
  4.      <!-- The CVSROOT value -->   
  5.      < property   name = "cvsroot"   value = ":pserver:dhf:@192.168.0.200:D:/cvs_repository_z" />   
  6.      < property   name = "cvs.password"   value = "" />   
  7.      
  8.      < property   name = "ywzcpt.dir"   value = "${basedir}/ywzcpt" />   
  9.      < property   name = "ywzcpt.module.name"   value = "ywzcpt" />   
  10.        
  11.      < property   name = "zfyw.dir"   value = "${basedir}/zfyw" />   
  12.      < property   name = "zfyw.module.name"   value = "zfyw" />   
  13.   
  14.      < property   name = "external.dir"   value = "${basedir}/external" />   
  15.      < property   name = "external.module.name"   value = "external" />   
  16.        
  17.      < property   name = "cvs-op"   value = "co "   />   
  18.      <!-- Initializing -->   
  19.      < target   name = "init" >   
  20.          < tstamp >   
  21.              < format   property = "today"   pattern = "yyyy-MM-dd hh:mm:ss" />   
  22.          </ tstamp >   
  23.          < echo   message = "${today}"   />   
  24.      </ target >   
  25.        
  26.      < target   name = "prepare"   depends = "init"   >   
  27.          < cvspass   cvsroot = "${cvsroot}"   password = "${cvs.password}"   passfile = "ant-cvs.cvspass" />   
  28.      </ target >   
  29.        
  30.      < target   name = "external-check-out"   depends = "prepare" >   
  31.          < cvs   cvsRoot = "${cvsroot}"   package = "${external.module.name}"     
  32.               passfile = "ant-cvs.cvspass" />   
  33.      </ target >   
  34.        
  35.      <!-- Retrieve the ywzcpt module -->   
  36.      < target   name = "ywzcpt-check-out"   depends = "external-check-out" >   
  37.          < delete   dir = "${ywzcpt.module.name}" />     
  38.          < cvs   cvsRoot = "${cvsroot}"   package = "${ywzcpt.module.name}"     
  39.               passfile = "ant-cvs.cvspass" />   
  40.      </ target >   
  41.   
  42.      < target   name = "zfyw-check-out"   depends = "external-check-out" >   
  43.          < delete   dir = "${zfyw.module.name}" />     
  44.          < cvs   cvsRoot = "${cvsroot}"   package = "${zfyw.module.name}"     
  45.               passfile = "ant-cvs.cvspass" />   
  46.      </ target >   
  47.   
  48.      <!-- cvs checkout -->   
  49.        
  50.      < target   name = "check-out" >   
  51.          < antcall   target = "external-check-out"   />   
  52.          < antcall   target = "ywzcpt-check-out"   />   
  53.          < antcall   target = "zfyw-check-out"   />   
  54.      </ target >   
  55.        
  56.      <!-- build XSP framework -->   
  57.      < target   name = "build" >   
  58.          < echo   message = "+=============================================+"   />   
  59.          < echo   message = "|     Start Building GNT for compilation      |"   />   
  60.          < echo   message = "+=============================================+"   />   
  61.            
  62.          < antcall   target = "ywzcpt-build"   />   
  63.            
  64.            
  65.          < echo   message = "+=============================================+"   />   
  66.          < echo   message = "|      End Building GNT for compilation       |"   />   
  67.          < echo   message = "+=============================================+"   />   
  68.            
  69.      </ target >   
  70.        
  71.      < target   name = "ywzcpt-build"   depends = "ywzcpt-check-out" >   
  72.          < echo   message = "+---------------------------------------------+"   />   
  73.          < echo   message = "|    Start Building ywzcpt for compilation    |"   />   
  74.          < echo   message = "+---------------------------------------------+"   />   
  75.   
  76.          < ant   antfile = "build.xml"   dir = "${ywzcpt.module.name}"   output = "ywzcpt.log"   />   
  77.   
  78.          < property   name = "ywzcpt.add"   value = "add ./build/log/*.log ./build/*.jar ./build/*.war" />   
  79.          < property   name = "ywzcpt.commit"   value ="commit -m '${today}' ./build/log/*.log ./build/*.jar    
  80.   
  81. ./build/*.war" />   
  82.            
  83.          < ant   antfile = "build.xml"   dir = "${ywzcpt.module.name}"   target = "commit-build"   />   
  84.            
  85.          < echo   message = "+---------------------------------------------+"   />   
  86.          < echo   message = "+     End Building ywzcpt for compilation     |"   />   
  87.          < echo   message = "+---------------------------------------------+"   />   
  88.      </ target >   
  89.        
  90.      < target   name = "zfyw-build"   depends = "zfyw-check-out, ywzcpt-build" >   
  91.          < echo   message = "+---------------------------------------------+"   />   
  92.          < echo   message = "|    Start Building ywzcpt for compilation    |"   />   
  93.          < echo   message = "+---------------------------------------------+"   />   
  94.   
  95.          < ant   antfile = "build.xml"   dir = "${zfyw.module.name}"   output = "zfyw.log"   />   
  96.   
  97.          < property   name = "zfyw.add"   value = "add ./build/log/*.log ./build/*.jar ./build/*.war" />   
  98.          < property   name = "zfyw.commit"   value ="commit -m '${today}' ./build/log/*.log ./build/*.jar    
  99.   
  100. ./build/*.war" />   
  101.            
  102.          < ant   antfile = "build.xml"   dir = "${zfyw.module.name}"   target = "commit-build"   />   
  103.            
  104.          < echo   message = "+---------------------------------------------+"   />   
  105.          < echo   message = "+     End Building ywzcpt for compilation     |"   />   
  106.          < echo   message = "+---------------------------------------------+"   />   
  107.      </ target >   
  108.   
  109.      < target   name = "clean"   >   
  110.          < delete   dir = "${ywzcpt.module.name}" />     
  111.      </ target >   
  112.      
  113. </ project >   

ywzcpt/build.xml片断:
代码
  1. 主要实现commit功能   
  2. <target name="commit-build">  
  3.     <cvs cvsRoot="${cvsroot}" passfile="${root.dir}/ant-cvs.cvspass"  
  4.          command="${ywzcpt.add}"/>  
  5.     <cvs cvsRoot="${cvsroot}" passfile="${root.dir}/ant-cvs.cvspass"  
  6.          command="${ywzcpt.commit}"/>  
  7. </target>  

最后,在win2k中制定一个计划任务,就可以了。
posted on 2007-01-16 10:58 Joinclass Inc 阅读(1754) 评论(1)  编辑 收藏 引用 所属分类: 配置管理软件测试JAVA专题
评论:
  • # re: 在ant中使用cvs功能自动完成每日构建  笑话 Posted @ 2007-08-06 15:17
    好也,支持下  回复  更多评论   

只有注册用户登录后才能发表评论。
 
Copyright © Joinclass Inc Powered by: 博客园 模板提供:沪江博客