Maven2 + Subversion + CruiseControl搭建持续集成环境
1.创建Maven2项目,并import到Subversion Repository。 2.下载CruiseControl,版本2.5。 3.创建CruiseControl的工作目录,结构如下: Java 代码 ccworkplace\ \logs \project_name \checkout \project_name \artifacts \project_name 注:CruiseControl支持
1.创建Maven2项目,并import到Subversion Repository。
2.下载CruiseControl,版本2.5。
3.创建CruiseControl的工作目录,结构如下:
- clearcase/" target="_blank" >ccworkplace\
- \logs
- \project_name
- \checkout
- \project_name
- \artifacts
- \project_name
注:CruiseControl支持构建多个项目,每个项目涉及:logs、checkout、artifacts。它们的作用分别是:记录build结果、checkout代码的工作目录、部件发布地。这个结构就是为了这三个目的而创建的,每一级下的project_name都是对应的。
4.修改%CruiseControl_Home%/ webapps/cruisecontrol/WEB-INF/web.xml:
- 查找:context-param logDir;修改它的值:…/ccworkplace/logs
- 查找:ArtifactServlet的init-param rootDir;修改它的值:…/ccworkplace/artifacts
5. 修改%CruiseControl_Home%/config.xml,内容:
- <cruisecontrol>
- <property name="cruisedir" value="…/ccworkplace"/>
- <property name="logdir" value="${cruisedir}/logs"/>
- <property name="checkoutdir" value="${cruisedir}/checkout"/>
- <property name="artifactdir" value="${cruisedir}/artifacts"/>
-
- <project name="codelinecomponents">
- <listeners>
- <currentbuildstatuslistener file="${logdir}/${project.name}/status.txt"/>
- </listeners>
- <bootstrappers>
- <svnbootstrapper localWorkingCopy="${checkoutdir}/${project.name}" />
- </bootstrappers>
- <modificationset quietperiod="30">
- <svn localWorkingCopy="${checkoutdir}/${project.name}"/>
- </modificationset>
- <schedule interval="300">
- <maven2 mvnscript="%M2_Home%/bin/mvn.bat"
- pomfile="${checkoutdir}/${project.name}/pom.xml"
- goal="clean site package"/>
- </schedule>
- <log dir="${logdir}/${project.name}">
- <merge dir="${checkoutdir}/${project.name}/target/surefire-reports"/>
- </log>
- <publishers>
- <onsuccess>
- <artifactspublisher dest="${artifactdir}/${project.name}"
- file="${checkoutdir}/${project.name}/target/${project.name}.jar"/>
- </onsuccess>
- </publishers>
- </project>
- </cruisecontrol>
6.运行%CruiseControl_Home%/cruisecontrol.bat,因为cruisecontrol.bat已经自带了jetty,之后进入:http://localhost:8080/即可。
原文转自:http://www.ltesting.net