2017-08-04 48 views
0

在春天启动的项目,我使用Apache的POM插件的CheckStyle如下图所示:Eclipse和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版本(4.6.1),我已经安装了Eclipse的CheckStyle从下面的路径插件:

Eclipse CheckStyle Plugin

固定的Eclipse插件强调所有Check作风问题之后,当我运行验证行家的目标,我还是看到了进口依存度由M报相关的控制台上许多检查风格违规aven插件例如

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. 

我想知道为什么而Maven插件也都尽管使用google_checks.xml事实报道他们的Eclipse插件并没有强调这些问题。如何对齐它们?

回答

2

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尝试使用新版本,但可能不会使用最新的。
他们的网站状态:

最新版本8.0.0,基于Checkstyle的8.0

要更改的Checkstyle maven-checkstyle-plugin使用的版本,请参阅https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html

相关问题