我使用的CruiseControl版本为2.8.2,这个版本是最新的版本,可能较以前的版本略有不同,但也是大同小异。
1. 安装CruiseControl
先双击安装文件,双击后,按提示,选择你要安装的路径。安装后,你所选择的路径下会出现一个CruiseControl的文件夹。比如我选择的路径是D:\CruiseControl。
目录下面有一个apache-ant-1.7.0的目录,是CruiseControl所集成Ant程序。 artifacts里面放了项目生成JAR文件,ect是CruiseControl内置的Jetty服务器的配置文件。lib里放了CruiseControl引用的一些库。log文件夹不用说,是CruiseControl的操作日志,在Project文件夹中,我们可以放入我们要集成的项目。Webapp文件夹是Jetty应用程序的文件夹。
双击安装目录下有个cruisecontrol.bat的文件,就会启动CruiseControl,CruiseControl用Jetty用为服务器,端口为8080,如果想要修改端口,可以修改etc/jetty.xml文件。
启动服务器后,用 http://localhost:8080/cruisecontrol/ 就可以访问CruiseControl了。
默认的情况下,cruisecontrol下面有一个示例的项目:connectfour。
2.增加集成项目
首先把需要集成的项目,放入project文件里面。然后修改根目录下的config.xml,在<cruisecontrol>结点下增加一个Project结点,如,我加入的项目为PuzzleWebWorld项目。则增加:
<project name="PuzzleWebWorld">
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
</listeners>
<bootstrappers>
<antbootstrapper anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" target="default" />
</bootstrappers>
<modificationset quietperiod="30">
<!-- touch any file in connectfour project to trigger a build -->
<filesystem folder="projects/${project.name}"/>
</modificationset>
<schedule interval="20">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml"/>
</schedule>
<publishers>
<onsuccess>
<artifactspublisher dest="artifacts/${project.name}" file="projects/${project.name}/target/${project.name}.jar"/>
</onsuccess>
</publishers>
</project>
这里要注意的是,你的项目根目录下,必须有build.xml这个文件。

