持续集成 Java手册
一、概念
Martin Fowler的文章:Continuous Integration 中文翻译:持续集成
二、工具
传统工具:JBuilder,VisualSourceSafe,Rational ClearCase
自动编译工具:Ant
回归测试工具:JUnit
代码检查工具:CheckStyle
持续集成工具:CruiseControl
三、步骤
-
CruiseControl监控远程版本控制系统的变化
-
变化发生时CruiseControl调用编译工具进行编译(Ant等)
-
编译成功后调用JUnit进行回归测试
-
编译成功后调用CheckStyle进行代码检查
-
打包,部署,更新版本控制系统
-
完毕后将编译结果、测试结果、代码检查结果发送至开发人员、主管经理,并发布至网站,甚至报警器
所有这一切都是按照编制好的脚本自动进行的
四、实施示例
目前我们使用的是ClearCase,主控软件为CruiseControl,其脚本文件为cccc.xml
-
配置远程版本控制系统
<modificationset quietperiod="60"> <clearcase branch="main" viewpath="D:/cc_view/chelseafc/Nucleus2.0/Port" recursive="true" /> </modificationset> |
-
配置编译工具
<schedule interval="60"> <ant antscript="C:/Java/JBuilder2005/thirdparty/ant/bin/ant.bat" buildfile="D:/cc_view/chelseafc/Nucleus2.0/Port/clearcase-build.xml" target="cleanbuild" multiple="1" /> </schedule> |
-
配置测试用例(在ant的配置文件中)
<target name="test" depends="init" description="Run unit tests"> <delete dir="${junit.results}" /> <mkdir dir="${junit.results}" /> <junit fork="yes" haltonfailure="yes"> <classpath refid="project.class.path" /> <formatter type=" |