Tuesday, September 3, 2013

Jenkins: Static Analysis with CheckStyle

In the last post I mention how to configure your Maven Webdriver project on Jenkins, today let's see how to configure checkStyle plugin for static analysis with jenkins.

Configure Check Style with Maven

Mention the following plugin in pom.xml, make sure you mention it inside build block 
pom.xml

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-checkstyle-plugin</artifactId>
 <version>2.10</version>
 <configuration>
  <sourceDirectory>src</sourceDirectory>
 </configuration>
</plugin>

Configure Check Style with Jenkins
follow the steps mention below to configure and generate checkStyle Report in jenkins
Install checkStyle plugin Navigate to Manage Jenkins->Manage Plugin and install checkStyle plugin and then restart the jenkins 

Configure checkStyle for project
 Following is how to configure checkStyle for Maven project, it might vary if you are using ANT. 
  • Append checkstyle:checkstyle to your build goal
  • check Publish Checkstyle analysis results
    Configure Checkstyle for project
    Configure checkStyle for Project
Configure checkStyle Reports
 Now you need to configure which reports you want to see for this project, follow the steps to configure reports
  • Navigate to Jenkins home page and create new view
    Add New Dashboard for checkStyle
    Add new dashboard for checkstyle
  • Select the project you want to include for checkStyle Report
    Add Projects for checkStyle Report
    choose jenkins jobs for checkstyle
  • Include the graphs/reports you want
    Select Graphs for checkStyle report
    configure checkstyle report in jenkins

2 comments:

Bruce Elvin said...

Thank you! I was searching for a way to quickly add assignments for my four classes to a blog, yet still have them separated by class AND have a message/announcements that are applicable to all.
static dashboard

Automated static analysis said...

Appreciate this blog. This blog provide complete information about use and importance of static analysis tool. Thanks for sharing

Post a Comment