CruiseControl 实践(一)

config.xml文件:
<cruisecontrol>
    <project name="FWMS_CHRIST" buildafterfailed="false" requiremodification="false" forceonly="false">
    <!-- 创建前动作 -->
        <!-- 用于监听项目状态的变化 -->
        <listeners>
            <currentbuildstatuslistener file="${logs.dir}\${project.name}\status.txt" />
        </listeners>
        <!-- 用于监听在Repository是否变化  如果变化quietperiod秒后创建-->
        <modificationset quietperiod="5" >
			<starteam folder="code/webApp" starteamurl="192.168.20.53:49201/FWMS_CHRIST" username="zhangkunlin" password="hello" />
        </modificationset>
        <!-- 用于每隔interval秒,CruiseControl去检查并计划一次构建 (schedule驱动modificationset)-->
        <schedule interval="30">
            <ant anthome="${ant.home}" buildfile="projects/${project.name}/build.xml" uselogger="true" usequiet="true" />
        </schedule>
        <!-- 用于得到并保存log文件。默认情况下,将放在projects/${project.name}的目录下 -->
        <log>
            <merge dir="projects/${project.name}/test-results"/>
            <merge dir="projects/${project.name}/check-results"/>
            <merge dir="projects/${project.name}/findbugs-results" pattern="*-fb.xml"/>
            <merge dir="projects/${project.name}/pmd-results" pattern="*-pmd.xml"/>
        </log>
        <!-- 用于将构建的结果(如二进制文件)发布到指定的位置 -->
        <publishers>
            <htmlemail mailhost="smtp.163.com"
                returnaddress="[email protected]"
                skipusers="false"
                subjectprefix="[CC构建日志]"
                css="webapps/cruisecontrol/css/cruisecontrol.css"
                xsldir="webapps/cruisecontrol/xsl"
                buildresultsurl="http://localhost:5555/cruisecontrol/buildresults/${project.name}"
                username="xxxx"
                password="xxxx"
                charset="UTF-8">
                <!-- 总是 -->
                <always address="[email protected]" />
                <!-- 
	                     失败   <failure address="[email protected]" />
    	                     成功<success address="[email protected]" />
                 -->
            </htmlemail>
        </publishers>
        
        <plugin name="starteambootstrapper" classname="net.sourceforge.cruisecontrol.bootstrappers.StarTeamBootstrapper" />
        <plugin name="starteam" classname="net.sourceforge.cruisecontrol.sourcecontrols.StarTeam" />
        
        <property name="cc.home" value="D:\cruisecontrol-bin-2.8.4" />
        <property name="ant.home" value="${cc.home}\apache-ant-1.7.0" />
        <property name="logs.dir" value="${cc.home}\logs" />
        <property name="artifact.dir" value="${cc.home}\artifacts" />
  		<property name="checkout.dir" value="D:\CHRIST\code" />
  	</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>


猜你喜欢

转载自julylin.iteye.com/blog/1022035