这几天在学习cruisecontrol,也看了不少人的博客,把自己在入门阶段学的看的东西写在这里吧
CruiseControl(以下简称CC)自带ant,logs 下面包括日志信息,可以通过在config.xml 中指定
日志路径和名称;projects 下面放的是需要进行持续集成的项目,lib 目录中放有cruisecontrol.jar 和其他运行需要的jar,webapps下是cruisecontrol build 结果的网站,可以通过访问http://127.0.0.1:8080/cruisecontrol 来查看build 的结果,个人更加喜欢先访问http://127.0.0.1:8080/ ,然后选择cruisecontrol或者dashboard,在build 后会产生artifacts 目录,这个目录用来存放发布的工件。
第一次启动CC之后会发现有一个默认的工程已经在projects 下了,根据这个工程的配置我们可以学到很多东西,为你自己的工程配置提供很多帮助。很多工程的配置都是类似的,举一反三就ok了,在CC根目录下的 config文件是cc的配置文件,调用工程的build文件。下面是我的config文件
<cruisecontrol>
<property name="artifacts" value="./artifacts"/>
<project name="yourprojectname">
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt" />
</listeners>
<bootstrappers>
<svnbootstrapper localWorkingCopy="projects/${project.name}" />
</bootstrappers>
<modificationset quietperiod="30">
<svn localWorkingCopy="projects/${project.name}" />
</modificationset>
<schedule interval="120">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" />
</schedule>
<log>
<merge dir="projects/${project.name}/target/test-results" />
</log>
<publishers>
<onsuccess>
<artifactspublisher dest="${artifacts}/${project.name}"
file="projects/${project.name}/dist/${project.name}.war" />
</onsuccess>
<htmlemail mailhost=""
returnaddress=""
buildresultsurl="">
<failure address="" />
<success address="" />
<success address="" />
</htmlemail>
<!--
logdir="C:/BuildServer/cruisecontrol-2.2/main/logs/frameworkProject"
xsldir="C:/BuildServer/cruisecontrol-2.2/reporting/jsp/xsl"
css="C:/cruisecontrol-bin-2.8.2/webapps/documentation/cruisecontrol.css"
subjectprefix="[Talent Build Server]"
-->
</publishers>
</project>
<project name="connectfour">
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt" />
</listeners>
<bootstrappers>
<antbootstrapper anthome="apache-ant-1.7.0"
buildfile="projects/${project.name}/build.xml" target="clean" />
</bootstrappers>
<modificationset quietperiod="30">
<!-- touch any file in connectfour project to trigger a build -->
<filesystem folder="projects/${project.name}" />
</modificationset>
<schedule interval="120">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml" />
</schedule>
<log>
<merge dir="projects/${project.name}/target/test-results" />
</log>
<publishers>
<onsuccess>
<artifactspublisher dest="artifacts/${project.name}"
file="projects/${project.name}/target/${project.name}.jar" />
</onsuccess>
</publishers>
</project>
</cruisecontrol>
工程build失败后的重新build问题
如果上一次build的结果是失败的,那么如果svn上没有更新,那么就不应该重新build,在project 标签中加入buildafterfailed="false",就可以了。结果如下:
<project name="ceocio" buildafterfailed="false"> </project>