Eclipse 和 Apache checkstyle 插件对齐
Eclipse and Apache checkstyle plugin alignment
在Spring启动项目中,我在POM中使用apache checkstyle插件,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<configLocation>google_checks.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
在 Eclipse Neon.1 Release (4.6.1) 中,我从以下路径安装了 Eclipse CheckStyle 插件:
修复了 Eclipse 插件突出显示的所有检查样式问题后,当我 运行 验证 maven 的目标时,我仍然在控制台上看到许多与 Maven 插件报告的导入依赖项相关的检查样式违规,例如
D:\Data\Filter.java:4: warning: 'com.microsoft.aad.adal4j.AuthenticationContext' should be separated from previous import group.
D:\Data\Filter.java:39: warning: Import statement for 'org.springframework.beans.factory.annotation.Value' is in the wrong order. Should be in the 'THIRD_PARTY_PACKAGE' group, expecting not assigned imports on this line.
我想知道为什么 eclipse 插件没有突出显示这些问题,而 Maven 插件却报告了这些问题,尽管事实上两者都在使用 google_checks.xml。如何对齐它们?
maven-checkstyle-plugin
默认使用旧版本的 Checkstyle。
请参阅 https://maven.apache.org/plugins/maven-checkstyle-plugin/history.html(它列出了 6.11.2 和 maven-checkstyle-plugin
版本 2.17)
根据您安装的 Eclipse-CS 版本,您可能会 运行 2 个不同版本的 Checkstyle,因为 Eclipse-CS 尝试使用更新版本,但可能不会使用最新版本。
他们的网站声明:
Latest release 8.0.0, based on Checkstyle 8.0
要更改 maven-checkstyle-plugin
使用的 Checkstyle 版本,请参阅 https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html。
在Spring启动项目中,我在POM中使用apache checkstyle插件,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<configLocation>google_checks.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
在 Eclipse Neon.1 Release (4.6.1) 中,我从以下路径安装了 Eclipse CheckStyle 插件:
修复了 Eclipse 插件突出显示的所有检查样式问题后,当我 运行 验证 maven 的目标时,我仍然在控制台上看到许多与 Maven 插件报告的导入依赖项相关的检查样式违规,例如
D:\Data\Filter.java:4: warning: 'com.microsoft.aad.adal4j.AuthenticationContext' should be separated from previous import group.
D:\Data\Filter.java:39: warning: Import statement for 'org.springframework.beans.factory.annotation.Value' is in the wrong order. Should be in the 'THIRD_PARTY_PACKAGE' group, expecting not assigned imports on this line.
我想知道为什么 eclipse 插件没有突出显示这些问题,而 Maven 插件却报告了这些问题,尽管事实上两者都在使用 google_checks.xml。如何对齐它们?
maven-checkstyle-plugin
默认使用旧版本的 Checkstyle。
请参阅 https://maven.apache.org/plugins/maven-checkstyle-plugin/history.html(它列出了 6.11.2 和 maven-checkstyle-plugin
版本 2.17)
根据您安装的 Eclipse-CS 版本,您可能会 运行 2 个不同版本的 Checkstyle,因为 Eclipse-CS 尝试使用更新版本,但可能不会使用最新版本。
他们的网站声明:
Latest release 8.0.0, based on Checkstyle 8.0
要更改 maven-checkstyle-plugin
使用的 Checkstyle 版本,请参阅 https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html。