灿烂的阳光,苦涩的生活,认真做,你能行!

CruiseControl使用笔记

上一篇 / 下一篇  2009-02-11 09:21:39 / 个人分类:文档

本文所用cruisecontrol版本是2.8。

1. 日构建配置

日构建是指在每天指定的时间进行构建。

1.1. <Project>

requireModification 设为 false,含义是无论有没有变化,都要进行构建。

1.2. <Listener>

    <listeners>

      <currentbuildstatuslistener file="logs/${project.name}/status.txt"/>

</listeners>

如果没有设置, 那么dashboard上的status将是空,但并不影响大局,一般就如上配置。

1.3. <bootstrappers>

Bootstrappers配置了检查变更前的任务,也在Schedule中的任务之前。这里要完成schedule中任务所依赖的文件的更新。

比如

<bootstrappers>

  <tfsbootstrapper itemSpec=“[vstsworkspace]\[setuppath]\build.xml />

</bootstrappers>

而cruisecontol给出的connectfour例子:

<bootstrappers>

            <antbootstrapper anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" target="clean" />

</bootstrappers>

实际上没有必要,大可放到 schedule中的任务中。

1.4. <modificationset>

对于日构建,这其实是不需要的,但由于cc必须要1个mondification,可以配一个无效。两个建议:

1,配成检查本机某个目录,这个目录不需要变化; 

    <modificationset >

      <filesystem folder="D:\WWS\JJJ"/>

    </modificationset>

2,配成timebuild

    <modificationset >

      <timebuild time="1200" />

</modificationset>

这与schedule中的time配置有所冲突,shedule中任务的time设置后,此设置无效。

1.5. <schedule >

属性interval 是设置检查更新的间隔秒数。如果下面的任务配置了 time,这个属性会变得无效。

对于日构建任务,建议只设置一个,首选ant任务,全部要完成的动作在ant的build.xml中。

例:

   <schedule interval="300">

      <ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" time="2112" />

</schedule>

Build.xml中处理了获取代码、编译、测试、打包、发布等等任务。

1.6. <log>

如果采用了ant中junit任务,可以用下面语句合并日志

    <log>

      <merge dir="projects/${project.name}/target/test-results"/>

    </log>

1.7. <publishers>

主要配置email通知。配置简单,按说明即可。要注意的是,在force build时,缺省地存在名为"User"的用户,在发送列表中,但"User"不是一个有效的email,因此加入"User"的别名来解决这个问题。示例如下:

    <publishers>

      <htmlemail buildresultsurl="http://xx" mailhost="smtphost" username="xxx" password="xxx" returnaddress="xxx@yyy.com">

        <map alias="User" address="xxxuser@gmail.com" />

         <always address="xxxxx@hotmail.com" />

        

      </htmlemail>

    </publishers>

对于项目群汇总报告,建议采用 <http>

也可以将build.xml中最后的发布任务放到这里。比如

<publishers>

<onsuccess>

    <antpublisher antscrīpt="C:\Java\apache-ant-1.6.1\bin\ant.bat"

         antworkingdir="D:\workspace\MyProject"

         buildfile="build.xml"

         target="publish">

     </antpublisher>

</onsuccess>

</publishers>


TAG: 文档

 

评分:0

我来说两句

Open Toolbar