When trying to add maven-checkstyle-plugin
to my Java project, I'm facing some weird issues.
The checkstyle version is 3.1.0, that uses checkstyle version 8.19. Below is the checkstyle.xml
the project is using:
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="TreeWalker">
<module name="LineLength">
<property name="max" value="120"/>
</module>
</module>
and my the configuration on the pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
Now, when I run mvn checkstyle:check
the following message is displayed:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0:check (default-cli) on project myproject: Failed during checkstyle configuration: LineLength is not allowed as a child in Checker -> [Help 1]
If I update the checkstyle to make it look like this
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="LineLength">
<property name="max" value="120"/>
</module>
I get the following message
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.0:check (default-cli) on project myproject: Failed during checkstyle configuration: Property 'max' does not exist, please check the documentation -> [Help 1]
I cannot reason what's happening since, to me, the error messages are misleading. What am I missing on this configuration?