Dashboard > CruiseControl > ... > IntegratingWithOtherTools > CheckStyle
CheckStyle Log In View a printable version of the current page.

Added by Chris Erskine , last edited by Chris Erskine on Jan 23, 2008  (view change)
Labels: 
(None)

Introduction

CheckStyle is a development tool to thep programmers write Java code that adheres to a coding standard.  It automates the process of checkingJava code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.

Checkstyle is highly configurable and can be made to support almost any coding standard. An example configuration file is supplied supporting the Sun Code Conventions. As well, other sample configuration files are supplied for other well known conventions.

These instructions show you how to arrange for the output to be generated and copied as an "artifact" that is stored as a persistent result of the build, and then how to arrange for that artifact to be published within the cruisecontrol web console.

 Step 1 - Add CheckStyle to your ant build

 For information on adding CheckStyle to your ant build, please refer to the CheckStyle Web site at http://checkstyle.sourceforge.net/anttask.html.  You want to have CheckStyle produce an XML formatted output file.

 Step 2 - Merge the output file into the log

In the <log> section of the project, you need to merge the output from CheckStyle into the log file.

<log>
  <merge file="projects/${project.name}/target/checkstyle.xml"/>
</log>

Step 3 - Enable the CheckStyle page in the web application

In the CruiseControl webapps directory, there is a file called main.jsp which we need to edit.  Locate the section of code that creates a new tabrow which has been commented out.  As part of the new tabrow, there is a tab for CheckStyle which calls the checkstyle.jsp.  Uncomment the section of code that you want.  Note that there is also a section of code that creates a tab for PMD that we do not need for this.

Rebuild the web application and redeploy it.

 <%--
              <cruisecontrol:tabrow/>
              <cruisecontrol:tab name="checkstyle" label="CheckStyle">
                <%@ include file="checkstyle.jsp" %>
              </cruisecontrol:tab>
              <cruisecontrol:tab name="pmd" label="PMD">
                <%@ include file="pmd.jsp" %>
              </cruisecontrol:tab>
--%>
Powered by a free Atlassian Confluence Open Source Project / Non-profit License granted to ThoughtWorks, Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators