Apache Maven Checkstyle Plugin – Code Style analysis

Apache Maven Checkstyle Plugin – Code Style analysis

Maven Check Style plugin is used to check the code style used by the developer or by an automation tester. This plugin will generate a compressive report stating all the warnings and errors against the predefined set of rules. If Required we can also configure our own rules to validate the code style.

To know more about this plugin please click on this link.

To configure Maven Check style plugin inside our project we need to put the below plugin into the reporting section of our POM.xml file.

Also, add below dependency into build section of our pom.xml file

Once this is done we need to execute mvn site

Also, we can use below command 

mvn clean install checkstyle:checkstyle from the command prompt

Once above command will get executed we will we able to see the report generated inside our project in target/site

Now this Report will give us comprehensive details regarding the code style and corresponding severity along with a lot of other details as well.

Alternatively, if we want that our build will get failed in the case in case these anomalies are more than some predefined threshold we need to use                   
                              mvn clean install checkstyle:check



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post