日期:2014-05-16  浏览次数:20661 次

CruiseControl中添加FindBugs的总结报告和结果标签
相关资料:http://confluence.public.thoughtworks.org/display/CC/Home
1:在X:\cruisecontrol-bin-2.8.4\webapps\cruisecontrol目录的main.jsp中添加:
<cruisecontrol:tabsheet>

              <cruisecontrol:tab name="buildResults" label="Build Results" >
                <%@ include file="buildresults.jsp" %>
              </cruisecontrol:tab>

			  <cruisecontrol:tab name="findbugs" label="FindBugs" >
					 <%@ include file="findbugs.jsp" %>
			  </cruisecontrol:tab>


2:新建findbugs.jsp文件
<%@ taglib uri="/WEB-INF/cruisecontrol-jsp11.tld" prefix="cruisecontrol"%>
<cruisecontrol:xsl xslFile="/xsl/findbugs-details.xsl"/>


3:在cruisecontrol.css添加格式信息:
.findbugs-oddrow { background-color:#CCCCCC }
.findbugs-data { font-family:arial,helvetica,sans-serif; font-size:8pt; color:#000000; }
.findbugs-sectionheader { background-color:#000066; font-family:arial,helvetica,sans-serif; font-size:10pt; 

color:#FFFFFF; }
.findbugs-tablerow0 { font-family:arial,helvetica,sans-serif; font-size:8pt; color:#000000; background-color: 

#FFFFFF; }
.findbugs-tablerow1 { font-family:arial,helvetica,sans-serif; font-size:8pt; color:#000000; background-

color:#CCCCCC; }
.findbugs-detailrow0 { font-family:arial,helvetica,sans-serif; font-size:8pt; color:#000000; background-color: 

#FFFFFF; }
.findbugs-detailrow1 { font-family:arial,helvetica,sans-serif; font-size:8pt; color:#000000; background-

color:#CCCCCC; }
.findbugs-tableheader { font-family:arial,helvetica,sans-serif; font-size:9pt; font-weight: bold; color:#000080; 

background-color:#CCDDDD; }
.findbugs-warningtable tr.findbugs-tablerow0:hover, .findbugs-warningtable tr.findbugs-tablerow1:hover { 

background-color: #aaffaa; }
.findbugs-priority-1 { color: red; font-weight: bold; }
.findbugs-priority-2 { color: orange; font-weight: bold; }
.findbugs-priority-3 { color: green; font-weight: bold; }
.findbugs-priority-4 { color: blue; font-weight: bold; }


4:在xsl目录下创建findbugs-details.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  FindBugs - Find bugs in Java programs
  Copyright (C) 2004,2005 University of Maryland
  Copyright (C) 2005, Chris Nappin

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-->

<!--
  A simple XSLT stylesheet to transform FindBugs XML results
  annotated with messages into HTML.

  If you want to experiment with modifying this stylesheet,
  or write your own, you need to generate XML output from FindBugs
  using a special option which lets it know to include
  human-readable messages in the XML.  Invoke the findbugs script
  as follows:

    findbugs -textui -xml:withMessages -project myProject.fb > results.xml

  Then you can use your favorite XSLT implementation to transform
  the XML output into HTML. (But don't use xsltproc. It generates well-nigh
  unreadable output, and generates incorrect output for the
  <script> element.)

  Authors:
  David Hovemeyer
  Chris Nappin (summary table)
  Nicholas Cull (adapted for CruiseControl)
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version