O'Reilly logo

Apache Maven Cookbook by Raghuram Bharathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Analyzing code with the Maven Checkstyle plugin

Checkstyle is a tool that helps programmers follow coding standards. It automates the process of checking if defined coding standards are followed. It can support any coding standards by suitable configuration. Like other tools, it can be run standalone as well as integrated with Maven.

How to do it...

Use the following steps to analyze code with the Maven Checkstyle plugin:

  1. Open the Maven project for which you want to do a Checkstyle analysis (for instance, project-with-violations).
  2. Run the following command:
    mvn checkstyle:checkstyle
    
  3. Observe the output as shown in the following screenshot:
    [INFO]
    [INFO] --- maven-checkstyle-plugin:2.13:checkstyle (default-cli) @ project-with-violations ---
    [INFO]
    [INFO] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required