我对checkstyle插件有这样的配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${test.checkstyle.version}</version>
<configuration>
<enableRulesSummary>false</enableRulesSummary>
<linkXRef>false</linkXRef>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failsOnError>false</failsOnError>
<failOnViolation>true</failOnViolation>
<configLocation>${proj_basedir}/checkstyle.xml</configLocation>
<suppressionsLocation>${proj_basedir}/checkstyle-suppressions.xml</suppressionsLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<excludes>**/generated-sources/**/*.java</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.13</version>
<exclusions>
<!-- MCHECKSTYLE-156 -->
<exclusion>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
,当我运行mvn compile checkstyle:checkstyle -nsu -Dskip.unit.tests
时,我发现存储在generated-sources
文件夹中的文件的checkstyle失败。
我从项目的根目录和pom xml的plugins部分中指定的插件中运行此命令。我还尝试将exclude
用作参数并获得相同的结果。还将checkstyle插件更新为最新版本。