Search code examples
mavenmaven-checkstyle-plugin

maven checkstyle plugin's JavaDocMethod attributes are not found during build


I want to fail the maven build when any public method doesn't have valid javadoc. I'm using maven checkstyle plugin as suggested over this site. But, it's giving me an error during build that the property allowUndeclaredRTE is not found. On commenting this, it gives error on another property.

My code snippet from pom is below:

<build>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
        <logViolationsToConsole>true</logViolationsToConsole>
        <failOnViolation>true</failOnViolation>
        <checkstyleRules>
            <module name="JavadocMethod">
                <property name="scope" value="public" />
                <property name="allowUndeclaredRTE" value="true" />
                <property name="allowMissingParamTags" value="false" />
            </module>
        </checkstyleRules>
    </configuration>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>


Solution

  • after removing the tag checkstyleRules, it worked as expected. Below is complete working code snippet.

    <build>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <logViolationsToConsole>true</logViolationsToConsole>
                <failOnViolation>true</failOnViolation>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </build>