CC中可以使用如下方式定义构建过程
<schedule Interval="60" ShowProgress="true" >
<exec command="mysh.sh" args="clean,test,build,report" workingDir="/home/somedir" errorStr="buildError" ShowProgress ="true" />
</schedule>
构建过程能够顺利进行,生成相应的文件。包括CruiseControl 生成的logs。但是在CC的WEB页面上,buildResults里面无法看到相应的具体信息。看配置的logs目录,确实有相应的log文件生成,其内容也是正常的。
经过分析发现由于CC对logs.xml使用XSLT进行转换,把log转换成显示用的HTML。但是再转换的过程中缺少对exec方式生成的log.xml的转换规则和模板。具体可以查看${cruisecontrol_home}/webapps/cruisecontrol/xsl/buildresults.xsl
解决方法是:
1, 新建一个在相同目录下新建一个exec.xsl文件,用于描述对exec的构建方式产生的log的转换规则。具体可以参考其他的同目录下其他xsl。
我的如下,可供参考:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/html4/strict.dtd" >
<xsl:output method="html"/>
<xsl:variable name="exec" select="/cruisecontrol/build/target/task[@name='mysh.sh']"/>
<xsl:template match="/" mode="exec">
<xsl:variable name="exec.messages" select="$exec/message"/>
<xsl:apply-templates select="/cruisecontrol/build/target/task" mode="exec"/>
</xsl:template>
<xsl:template match="/cruisecontrol/build/target/task[@name='exec']" mode="exec">
<table align="center" cellpadding="2" cellspacing="0" border="0" width="98%">
<!-- Style download notifications first -->
<tr class="compile-sectionheader">
<td>Antx Messages</td>
</tr>
<tr>
<td>
<xsl:apply-templates select="$exec/message" mode="antx"/>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="message[@priority='error']" mode="exec">
<span class="compile-error-data">
<xsl:value-of select="text()"/><xsl:text disable-output-escaping="yes"><![CDATA[<br/>]]></xsl:text>
</span>
</xsl:template>
<xsl:template match="message[@priority='warn']" mode="exec">
<span class="compile-data">
<xsl:value-of select="text()"/><xsl:text disable-output-escaping="yes"><![CDATA[<br/>]]></xsl:text>
</span>
</xsl:template>
<xsl:template match="message[@priority='info']" mode="exec">
<span class="compile-data">
<xsl:value-of select="text()"/><xsl:text disable-output-escaping="yes"><![CDATA[<br/>]]></xsl:text>
</span>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="." mode="exec"/>
</xsl:template>
</xsl:stylesheet>
2. 修改buildresults.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="maven.xsl"/>
<xsl:import href="nant.xsl"/>
<xsl:import href="checkstyle.xsl"/>
<xsl:import href="pmd.xsl"/>
<xsl:import href="macker.xsl"/>
<xsl:import href="errors.xsl"/>
<xsl:import href="compile.xsl"/>
<xsl:import href="javadoc.xsl"/>
<xsl:import href="unittests.xsl"/>
<xsl:import href="fittests.xsl"/>
<xsl:import href="modifications.xsl"/>
<xsl:import href="cvstagdiff.xsl"/>
<xsl:import href="distributables.xsl"/>
<xsl:import href="exec.xsl"/>
<xsl:output method="html"/>
<xsl:variable name="cruisecontrol.list" select="."/>
<xsl:template match="/">
<p><xsl:apply-templates select="$cruisecontrol.list" mode="maven"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="exec"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="nant"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="checkstyle"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="pmd"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="macker"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="errors"/></p>
<!--
for traditional cc display of only compile errors and warnings
comment out mode="errors" and uncomment mode="compile" and mode="javadoc"
<p><xsl:apply-templates select="$cruisecontrol.list" mode="compile"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="javadoc"/></p>
-->
<p><xsl:apply-templates select="$cruisecontrol.list" mode="unittests"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="fittests"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="modifications"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="cvstagdiff"/></p>
<p><xsl:apply-templates select="$cruisecontrol.list" mode="distributables"/></p>
</xsl:template>
</xsl:stylesheet>
分享到:
相关推荐
主题:持续集成及CruiseControl技术交流 在提升软件质量、降低研发风险、拒绝浪费方面,处于敏捷实践领域的持续集成(Continuous Integration,CI)起到重要作用。持续集成能够解决研发工作中的80%任务(日常),...
cruisecontrol配置定时运行
CruiseControl.NET 是 .NET...CruiseControl是一个针对持续构建程序(项目持续集成)的框架,它包括一个email通知的插件,Ant和各种各样的CVS工具。CruiseControl提供了一个Web接口, 可随时查看当前的编译状况和历史状况。
CruiseControl简介及使用举例
使用CruiseControl构建持续集成服务器.pdf
cruisecontrol配置文件,很实用
cruisecontrol简介
cruisecontrol、ant、svn持续集成 己两个多星期以来对持续集成的概念和应用有了一些了解。下面主要对自己配置持续集成的环境进行总结。(看上去简单,但是对我开始对持续集成都没什么了解的人来说确实费了不少周折)
CruiseControl-2.8.4.exe
SVN(Subversion)是一种版本控制系统,能够帮助开发团队管理代码变更,而 CruiseControl 是一个自动化构建工具,能够自动地构建和测试软件。将 SVN 和 CruiseControl 结合使用,可以实现自动化的构建、测试和部署,...
cruisecontrol+maven2配置做持续集成
[CruiseControl]binary安装和启动
持续集成配置 持续集成环境:Maven2 + Subversion + CruiseControl CC原理 以及一些样例
CruiseControl笔记,详细介绍了CruiseControl。net的配置,希望对大家有所帮助
CruiseControl.NET-1.4.4-Setup.exe
CruiseControl.NET-CCTray-1.8.4.0-Setup.exe
With the emergence of vehicle-to-vehicle communi-cation technology, cooperative adaptive cruise control (CACC) cars can be expected in the near future. In this paper, novel criteria for string ...
CruiseControl.NET-CCTray-1.5.6804.1-Setup
而现在,CruiseControl已发展成为一个家族式系统,包括CruiseControl.java、CruiseControl.net、CruiseControl.ruby等适应不同语言环境的实现,其强大的插件和扩展能力也是诸多同类系统无法比你的。而在这里,我只...
1.认识CruiseControl 2.CruiseControl的安装 3. CruiseControl的配置 4.总结