I've using the maven-checkstyle-plugin (config see below) in version 3.2.1 for quite some time now and I'm also using a custom checkstyle.xml and suppressions.xml
e.g. in the suppressions.xml I have entries like:
<suppress files="messages.properties" checks="[a-zA-Z0-9]*"/>
<suppress files="target/generated-sources" checks=".*"/>
Since a few days, I see an error message in my eclipse (2023-03), e.g. in the above mentioned message.properties file:
(!) Line is longer then 120 characters (found xxx)
my.lang.key = a very long line with more then 120 chars, but this file should be ignored at all ...
The generated code in target/generated-sources/... is also clustered with checkstyle errors, although the files in this path should not be validated.
If I run a build on the console the build does not fail, hence the plugin is respecting the suppression.xml file, but the error flag in eclipse is still shown.
An update to maven-checkstyle-plugin:3.2.2 and checkstyle:10.11.0 (currently most recent versions) did not fix the problem.
Just another observation, I also have a new meta/config file in my project: .checkstyle, I suppose this is related ...?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.1</version>
<dependencies>
<dependency>
<groupId>acme</groupId>
<artifactId>checkstyle-config-cms</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.6.0</version>
</dependency>
</dependencies>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>suppressions.xml</suppressionsLocation>
<inputEncoding>UTF-8</inputEncoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Unfortunately, until now I did not come up with a better solution then to disable the checkstyle plugin within eclipse.
To do so, right click your project ->
Checkstyle->Deactivate CheckstyleIf the error is still shown you must clear your checkstyle violations. The maven run is not affected by this change and still is using checkstyle correctly.
Update (2024/01/24):
As it turns out you can avoid this problem when importing a project into eclipse (I'm using currently version: 2023-12 - freshly installed).
When I import a clean
mavenproject that is using thecheckstyle-maven-plugininto eclipse. I get a pop-up asking to setup amaven plugin connector.You probably can skip/cancel this, BUT if you are adding in advance some eclipse meta data information (see eclipse release-notes-17), e.g.
<?m2e ignore?>Eclipse will not ask you to take control of the
checkstylehandling and most probably will not make the above mentioned problems.