i want to use the Maven Checkstyle plugin with a custom configuration that tells Checkstyle to not warn or error on missing Javadoc. Is there a way to do this?
If you want to disable checkstyle from your pom, you can add the checkstyle plugin to the pom and set the skip flag to prevent the check.
Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to. Click on the gear, then 'import scheme', choose "CheckStyle Configuration" and select a corresponding CheckStyle configuration file. Click OK.
Goals Overviewcheckstyle:check is a goal that performs Checkstyle analysis and outputs violations or a count of violations to the console, potentially failing the build. It can also be configured to re-use an earlier analysis.
Just found it myself. To fully ignore all javadoc checking for everthing, add this to your checkstyle configuration:
<!-- No need for Javadoc -->
<module name="JavadocType">
<property name="severity" value="ignore"/>
</module>
<module name="JavadocMethod">
<property name="severity" value="ignore"/>
</module>
<module name="JavadocVariable">
<property name="severity" value="ignore"/>
</module>
One good option would be configuring a suppressions filter.
Plugin configuration:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- ... -->
<build>
<plugins>
<!-- ... -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>verify</id>
<phase>verify</phase>
<configuration>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<suppressionsLocation>
checkstyle-suppressions.xml
</suppressionsLocation>
<suppressionsFileExpression>
checkstyle.suppressions.file
</suppressionsFileExpression>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- ... -->
</project>
checkstyle-suppressions.xml
file:
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
<suppressions>
<suppress checks="Javadoc" files="."/>
</suppressions>
Then running
$ mvn verify
Does not output any Javadoc-related Checkstyle errors.
Many other examples on suppressions filters may be found in checkstyle repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With