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 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
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