构建 XStream 有问题?
有可能发现 XStream 构建失败,报告org.w3c.dom.TypeInfo的NoClassDefFoundError错误。实际上,构建几乎就成功了,但是 XStream 的 Ant 构建脚本用<junitreport>任务生成 JUnit 测试结果的 HTML 报告。这个工作使用 XSLT 转换,所以触发了前面我在初始配置一节中提到过的 xerces-j2 包中的 bug。 [cruise@fcvm ~]$cd src/xstream[cruise@fcvm xstream]$ant libraryBuildfile: build.xml compile: [mkdir] Created dir: /home/cruise/src/xstream/build/java [echo] Java version used for compile: 1.4.2_08 [javac] Compiling 150 source files to /home/cruise/src/xstream/bui ld/java[...]library: BUILD SUCCESSFUL Total time: 1 minute 44 seconds [cruise@fcvm xstream]$
而且,在添加新项目时,需要找到用来构建源和清理其中制品的目标的名称。必须把这个信息放在 config.xml 文件中。
现在应当做好准备,可以让 CruiseControl 自动执行这个构建了。只要启动 CruiseControl,然后坐下来等待就可以了:
[cruise@fcvm xstream]$cd[cruise@fcvm ~]$java -jar \ pkg/cruisecontrol-2.2.1/main/dist/cruisecontrol.jar[cc]Aug-24 20:09:31 Main - CruiseControl Version 2.2.1 [cc]Aug-24 20:09:32 trolController- projectName = [xstream] [cc]Aug-24 20:09:32 trolController- No previously serialized project f ound: /home/cruise/xstream [cc]Aug-24 20:09:32 Project - Project xstream: reading settings from config file [/home/cruise/config.xml] [cc]Aug-24 20:09:32 BuildQueue - BuildQueue started [cc]Aug-24 20:09:32 Project - Project xstream starting [cc]Aug-24 20:09:32 Project - Project xstream: idle [cc]Aug-24 20:09:32 Project - Project xstream started [cc]Aug-24 20:09:32 Project - Project xstream: next build in 1 hours [cc]Aug-24 20:09:32 Project - Project xstream: waiting for next time to build [cc]Aug-24 21:09:33 Project - Project xstream: in build queue [cc]Aug-24 21:09:33 BuildQueue - now adding to the thread queue: xs tream [cc]Aug-24 21:09:33 Project - Project xstream: reading settings from config file [/home/cruise/config.xml] [cc]Aug-24 21:09:33 Project - Project xstream: bootstrapping [cc]Aug-24 21:09:33 Project - Project xstream: checking for mod ifications [cc]Aug-24 21:09:59 Project - Project xstream: No modifications found, build not necessary. [cc]Aug-24 21:09:59 Project - Project xstream: Building anyway, since build was explicitly forced. [cc]Aug-24 21:09:59 Project - Project xstream: now building Buildfile: build.xml [cc]Aug-24 21:11:29 Project - Project xstream: merging accumula ted log files [cc]Aug-24 21:11:30 Project - Project xstream: build successful [cc]Aug-24 21:11:30 Project - Project xstream: publishing build results [cc]Aug-24 21:11:30 Project - Project xstream: idle [cc]Aug-24 21:11:30 Project - Project xstream: next build in 1 hours [cc]Aug-24 21:11:30 Project - Project xstream: waiting for next time to build[stop CruiseControl using Ctrl-C][cruise@fcvm ~]$
让 CruiseControl 一直运行
现在是让 CruiseControl 运行了,但是还不能让它在没人参与的情况下运行。它目前在一个终端窗口中运行,所以需要让cruise用户永远登录,才能保持它一直运行。终端还是控制程序的唯一方式:可以按下Ctrl+C停止 CruiseControl,并再次运行程序重新启动它。除非使用虚拟网络计算(VNC)会话或类似的东西,否则就不能远程地做上面这些事。如果 CruiseControl(或者 JVM)崩溃,就需要手动地重启它。而且当重新启动机器时,也需要手动地建立新会话、创建终端、再次启动程序,CruiseControl 才能重启。所以需要让 CruiseControl 作为一个服务运行,或者用 Unix 的术语来说,作为一个守护程序运行。
让程序在 Linux 下持续运行的方法有许多种。最常用的方法可能是把合适的脚本挂上init系统初始化进程,在系统启动时启动程序。这些脚本可以启动和停止程序,但是不能在程序出现故障时自动重启程序。
我用的方法 I 是下载并安装 Daniel J. Bernstein 的daemontools(请参阅参考资料)。这是一个小的程序包,负责启动一组服务并保持这些服务一直运行。要执行自己的daemontools安装,需要登录为root:
[root@fcvm ~]#mkdir -p /package[root@fcvm ~]#chmod 1755 /package[root@fcvm ~]#cd /package[root@fcvm package]#wget -q http://cr.yp.to/\ daemontools/daemontools-0.76.tar.gz[root@fcvm package]#gunzip daemontools-0.76.tar.gz[root@fcvm package]#tar -xpf daemontools-0.76.tar[root@fcvm package]#rm daemontools-0.76.tarrm: remove regular file 'daemontools-0.76.tar'?y[root@fcvm package]#
文章来源于领测软件测试网 https://www.ltesting.net/