使用 Sun SPOT 作为构建监视器
2009-12-22 00:00:00 来源:WEB开发网清单 7 为 SPOT 的 8 个 LED 分别设置颜色,并根据构建的状态打开或关闭这些 LED。
下一步是将构建监视器附加到持续构建过程。
CruiseControl 配置
当 CruiseControl 开始时,它在一个连续循环中运行,周期性地检查源代码库,例如 Subversion,然后从头开始构建和测试项目。然后,CruiseControl 可以将构建成功或失败的状态发布到网站上,供所有人查看,并发出各种不同的消息。
CruiseControl 循环的行为由一个 XML 配置文件 config.xml 表示,如清单 8 所示:
清单 8. CruiseControl 配置文件<cruisecontrol>
<property environment="env"/>
<property name="local.directory" value="C:\data\skills\development\builds"/>
<property name="repository" value="http://kimba/svn"/>
<property name="javaExecutable" value="C:\applications\java\jdk1.6.0_14\bin\
java.exe"/>
<property name="workingDirectory" value="C:\data\skills\development\java\micro\
netbeans\sunspots\CanaryHandler\dist"/>
<property name="libraryPath" value="-Djava.library.path=C:\applications\Sun\
SunSPOT\sdk-red-090706\lib"/>
<property name="commonArguments" value="${libraryPath} -jar
${workingDirectory}\CanaryHandler.jar
--spot "0014.4F01.0000.3A19"
--port 100
--serial COM4"/>
<plugin name="log" dir="${logdir}"/>
<plugin name="svn" classname="net.sourceforge.cruisecontrol.sourcecontrols.SVN"
username="cruise"
password="catbert"/>
<project name="developer-ci-build" buildafterfailed="false">
<!-- Defines where CruiseControl looks for changes to decide whether to run the build. -->
<modificationset quietperiod="30">
<svn localWorkingCopy="${local.directory}/checkout/SunDeveloper"
repositoryLocation="${repository}/DEVELOPER/trunk/SunDeveloper"/>
</modificationset>
<!-- Check for modifications every 60 seconds -->
<schedule interval="60">
<composite>
<exec command="${javaExecutable}" args="${commonArguments}
--running"/>
<maven2 mvnhome="${env.MAVEN_HOME}"
pomfile="${local.directory}/checkout/SunDeveloper/pom.xml"
goal="clean | scm:update | compile"/>
</composite>
</schedule>
<listeners>
<currentbuildstatuslistener
file="${local.directory}/logs/${project.name}/buildstatus.txt"/>
</listeners>
<!-- The publishers are run when a build completes one way or another. -->
<publishers>
<onsuccess>
<execute command="${javaExecutable} ${commonArguments}
--success"/>
</onsuccess>
<onfailure>
<execute command="${javaExecutable} ${commonArguments}
--failed"/>
</onfailure>
</publishers>
</project>
</cruisecontrol>
更多精彩
赞助商链接