mavencheckstyle

Run Maven Checkstyle with Custom Checkstyle


I ran mvn checkstyle:checkstyle, but it's not using my custom checkstyle XML file.

Please advise me how to use my own checkstyle file rather than the default/whichever it's configured to now?


Solution

  • You need to configure the file location in your pom.xml:

    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.9.1</version>  
          <configuration>
            <configLocation><!-- Specify file here --></configLocation>
          </configuration>
        </plugin>  
      </plugins>
    </build>
    

    Check the this page to see other configuration options.