CruiseControl
本章任务
1.了解CruiseControl
官方网址:http://cruisecontrol.sourceforge.net/
官方介绍
CruiseControl is both a continuous integration tool and an extensible framework for creating a custom continuous build process. It includes dozens of plugins for a variety of source controls, build technologies, and notifications schemes including email and instant messaging. A web interface provides details of the current and previous builds. And the standard CruiseControl distribution is augmented through a rich selection of 3rd Party Tools.
CruiseControl is written in Java but is used on a wide variety of projects. There are builders supplied for Ant, NAnt, Maven, Phing, Rake, and Xcode, and the catch-all exec builder that can be used with any command-line tool or script.
CruiseControl is open source software and is developed and maintained by a group of dedicated volunteers. CruiseControl is distributed under a BSD-style license.
CruiseControl的既是一个持续集成工具,用于创建自定义生成过程中不断扩展的框架。它包括了几十个插件的源控件品种,建立技术,并通知计划,包括电子邮件和即时消息。 Web界面提供了当前和以前版本的细节。 CruiseControl的分布和标准是增强通过丰富的第三方工具的选择。
CruiseControl是Java编写的,而是基于一种广泛用于各种项目。Ant, NAnt, Maven, Phing, Rake, and Xcode供应商,并收集所有Exec的生成器,可与任何命令行工具或脚本使用。
CruiseControl是开放源码软件和开发,并有专门的志愿者群体维持。 CruiseControl支持分布式。
CI其实是由一系列的最佳实践所构成:
.源代码的版本控制和管理
- 自动化构建
- 自动化测试
- 代码审查
- 自动发行和部署
- 持续反馈
使用持续集成的作用:
持续集成(CI)是一种实践,可以让团队在持续的基础 上收到反馈并进行改进,不必等到开发周期后期才寻找和修复缺陷。诸如 CruiseControl 之类的检查工具是在后台运行的,它们轮询版本控制存储库,从中寻找更改之处。当发现某一更改时,这类工具就会通过 Ant 执行预定义的构建脚本。持续检查借助持续集成的实践得以改进。
持续集成周期包括以下几个步骤:
1. 持续集成服务器不断从版本控制服务器上检查代码状态,看代码是否有更新。
2. 如果发现代码有最新的提交,那么就从版本控制服务器下载最新的代码。
3. 等代码完全更新以后,调用自动化编译脚本,进行代码编译。
4. 运行所有的自动化测试。
5. 进行代码分析。
6. 产生可执行的软件,能够提供给测试人员进行测试。
2.配置文件包括两个,一个名为config.xml,另一个名为dashboard-config.xml。默认情况下,这两个文件和cruisecontrol.bat在同一下目录下,即工作目录。
CruiseControl的配置文件config.xml
<cruisecontrol>
<project name="test">--这里的name应该和你在projects目录下的项目名完全一致,且和svn里的服务名也要一致。
<listeners> --用于监听项目状态的变化(指building,passed等)
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>--这里的${project.name}就是test,status.txt记录当前项目的状态
</listeners>
<bootstrappers>--用于CruiseControl从Repository更新代码,target="ci" 对应的是build.xml里的<project name="test" basedir="." default="ci">
<antbootstrapper anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" target="ci" />
</bootstrappers>
<modificationset quietperiod="30">--用于监听在quietperiod秒内,Repository是否变化,如果有变化自动集成测试,无变化就不做任何处理
<svn localWorkingCopy="projects/${project.name}" username="0902.aibaorong" password="aibaorong"/>--对应svn的用户名和密码
</modificationset>
<schedule interval="30">--用于每隔interval秒,CruiseControl去检查并计划一次构建,这里是30秒
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml"/>
</schedule>
<log> --用于得到并保存log文件。默认情况下,将放在projects/${project.name}的目录下
<merge dir="projects/${project.name}/target/test-results"/> --用于将Build中生成的结果合并
</log>
<publishers>--用于将构建的结果(如二进制文件)发布到指定的位置
--决定在构建成功的情况下,发布哪些内容,这里配置的是生成javadoc,这里一般配置
--javadoc,checkstyle,cobertura,findbugs,functiontest,javancss,jdepend,loadtest(jmeter),pmd
<onsuccess>
<artifactspublisher dest="artifacts/${project.name}"
dir="projects/${project.name}/cioutput/apidoc" subdirectory="javadocs" />
</onsuccess>
</publishers>
</project>
</cruisecontrol>
CruiseControl的配置文件dashboard-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/********************************************************************************
* CruiseControl, a Continuous Integration Toolkit
* Copyright (c) 2007, ThoughtWorks, Inc.
* 200 E. Randolph, 25th Floor
* Chicago, IL 60601 USA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* + Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* + Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************/
-->
<dashboard>
<buildloop
logsdir=""--这里指定logs目录,一定要与config.xml文件中一致,否则你会有麻烦。 如果为空串,则默认为工作目录下的logs目录。
artifactsdir="" />--这里指定artifacts目录,一定要与config.xml文件中一致,如果为空串,则默认为工作目录下的artifacts目录。
<features allowforcebuild=""/>--是否可以在Dashboard上强制构建(force build)
<trackingtool projectname="" baseurl="" keywords=""/>--这是用于与Mingle的集成
<subtabs> --在这里,你可以自己扩展你自己的subtab页,不过要先实现一些接口。
<subtab class="net.sourceforge.cruisecontrol.dashboard.widgets.ErrorsAndWarningsMessagesWidget" />
</subtabs>
</dashboard>
CruiseControl的配置文件config.xml(官方提供的所有的属性)
官方网址:http://cruisecontrol.sourceforge.net/main/configxml.html
<cruisecontrol>
<property/>
<dashboard/>
<include.projects/>
<system>
<configuration>
<threads/>
</configuration>
</system>
<plugin/>
<project>
<property/>
<plugin/>
<cvslabelincrementer>
<emptylabelincrementer>
<formattedlabelincrementer>
<labelincrementer/>
<p4changelistlabelincrementer>
<propertyfilelabelincrementer>
<svnlabelincrementer>
<listeners>
<cmsynergysessionmonitor/>
<currentbuildstatusftplistener/>
<currentbuildstatuslistener/>
<currentbuildstatuspagelistener/>
<lockfilelistener/>
</listeners>
<bootstrappers>
<accurevbootstrapper/>
<alienbrainbootstrapper/>
<antbootstrapper/>
<clearcasebootstrapper/>
<clearcaseviewstrapper/>
<cmsynergybootstrapper/>
<cmsynergybaselinebootstrapper/>
<cvsbootstrapper/>
<darcsbootstrapper/>
<execbootstrapper/>
<gitbootstrapper/>
<harvestbootstrapper/>
<lockfilebootstrapper/>
<mercurialbootstrapper/>
<p4bootstrapper/>
<plasticscmbootstrapper/>
<snapshotcmbootstrapper/>
<starteambootstrapper/>
<surroundbootstrapper/>
<svnbootstrapper/>
<tfsbootstrapper/>
<vssbootstrapper/>
</bootstrappers>
<modificationset>
<accurev>
<alienbrain/>
<alwaysbuild/>
<buildstatus/>
<clearcase/>
<cmsynergy/>
<compound>
<targets/>
<triggers/>
</compound>
<cvs/>
<darcs/>
<filesystem/>
<forceonly/>
<git/>
<harvest/>
<httpfile/>
<mavensnapshotdependency/>
<maven2snapshotdependency/>
<mercurial/>
<mks/>
<p4/>
<plasticscm/>
<pvcs/>
<snapshotcm/>
<starteam/>
<store/>
<surround/>
<svn/>
<tfs/>
<timebuild>
<ucm>
<veto/>
<vss/>
<vssjournal/>
</modificationset>
<schedule>
<ant/>
<maven/>
<maven2/>
<pause/>
<nant/>
<phing/>
<rake/>
<exec/>
<composite/>
<xcode/>
</schedule>
<log>
<merge/>
<gzip/>
<delete/>
<deleteartifacts/>
</log>
<publishers>
<antpublisher/>
<artifactspublisher/>
<clearcasebaselinepublisher/>
<cmsynergybaselinepublisher/>
<cmsynergytaskpublisher/>
<compoundpublisher/>
<email/>
<execute/>
<ftppublisher/>
<htmlemail/>
<http>
<jabber/>
<onfailure/>
<onsuccess/>
<origo/>
<rss/>
<sametimeannouncement/>
<scp/>
<sfeedocman/>
<sfeefrs/>
<sfeetracker/>
<socket/>
<twitter>
<weblog>
<x10/>
<xsltlogpublisher/>
<yahoopublisher/>
</publishers>
</project>
</cruisecontrol>
小贴士
在Config.xml文件中,有几个元素的概念要先澄清一下(只针对当前示例,严格定义请参见CruiseControl的文档)。
<listeners> 用于监听状态变化,如waiting for build,queued,building。一般不用改变。
<bootstrappers>用于检出代码,CruiseControl有很多种bootstrapper,示例中使用的是SVN。localWorkingCopy属性是指你把代码检出到安装CruiseControl机器的哪个文件目录。
<modificationset>用于监听Repository的变化频率,如果CruiseControl发现代码有变化,而且在quietperiod秒内没有其它用户检入代码(用于保证被构建的版本完整性),CruiseControl才会检出代码。
<schedule >用于指定CruiseControl去检查Repository的时间间隔。并指定使用哪个构建文件。示例中使用的是ant脚本,构建文件是被检出项目的根目录下的build.xml(即在Repository中)。
<log>用于指定CruiseControl把日志放在哪里,把哪些构建结果放在日志中。如果没有指定任何属性,默认为logs目录下的${project.name}目录。
<publishers> 用于在构建结束后,发布哪些消息和文件。CruiseControl有很多插件可以做各种各样的Publishing。例如,在构建成功后,通过http调用指定的页面,也可以给指定的人发邮件。在失败时,播放音乐,通知team。
本章目标
1. 了解CruiseControl
分享到:
相关推荐
CruiseControl是一款持续集成工具,它能够自动化地执行软件项目的构建、测试和部署流程,以确保代码的质量和项目的稳定性。本篇文章将详细介绍CruiseControl的基本概念、安装过程、配置方法以及一个简单的使用示例。...
CruiseControl是一款持续集成工具,它能够自动化地构建、测试和部署软件项目,极大地提高了开发效率和产品质量。在本文中,我们将深入探讨如何配置CruiseControl以实现定时运行,确保项目始终保持最新状态。 首先,...
### [CruiseControl] Binary安装与启动指南 #### 一、CruiseControl简介 CruiseControl 是一个持续集成工具,用于自动化构建过程并提供实时反馈,帮助开发团队尽早发现问题。它支持多种构建工具如 Ant 和 Maven,...
CruiseControl 是一个开源的持续集成工具,用于自动化软件构建、测试和部署的过程。它通过监控版本控制系统中的变更,自动触发构建任务,及时发现并解决代码集成中的问题,从而提高开发团队的效率和软件质量。本...
**持续集成之CruiseControl.rb** CruiseControl.rb是一款开源的持续集成工具,主要用于自动化构建、测试和部署软件项目。它是由ThoughtWorks公司开发的,是CruiseControl.NET的Ruby版本,因此在Ruby社区中被广泛...
标题与描述概述的知识点主要涉及了使用CruiseControl与Maven2进行持续集成的配置流程。这是一项在软件开发过程中非常关键的技术实践,它能够自动检测代码库中的更新,并自动执行构建、测试以及部署等任务,从而确保...
主题:持续集成及CruiseControl技术交流 在提升软件质量、降低研发风险、拒绝浪费方面,处于敏捷实践领域的持续集成(Continuous Integration,CI)起到重要作用。持续集成能够解决研发工作中的80%任务(日常),...
CruiseControl-2.8.4.exe
CruiseControl是一款开源的持续集成工具,用于自动化软件开发过程中的构建、测试和部署任务。这份"CruiseControl使用指南.rar"包含了一系列关于如何有效利用CruiseControl进行持续集成的资源,包括文章、教程和示例...
CruiseControl.NET-1.4.4-Setup.exe
"利用CruiseControl软件进行持续集成" 在软件开发过程中,持续集成是一个非常重要的步骤,它可以帮助开发团队更好地合作和跟踪项目的进度。CruiseControl是一种流行的持续集成工具,能够自动化地构建、测试和部署...
cruisecontrol简介
自适应巡航控制(Adaptive Cruise Control, 简称ACC)是一种高级驾驶辅助系统,它在传统的巡航控制基础上增加了车辆自主调节车速的能力,以保持与前车的安全距离。MATLAB是一款广泛应用于数学计算、数据分析和算法开发...
CruiseControl.NET-CCTray-1.8.4.0-Setup.exe
CruiseControl.NET 是 .NET 平台下的持续集成工具,CruiseControl (Java) 的 .NET 移植版本。CruiseControl是一个针对持续构建程序(项目持续集成)的框架,它包括一个email通知的插件,Ant和各种各样的CVS工具。Cruise...
### Cruisecontrol:持续集成平台与分布式构建实践 #### 一、CruiseControl简介 CruiseControl是一个开源的持续集成平台,旨在帮助企业实现自动化构建过程,提高软件开发效率和质量。项目采用Apache许可证发布,...