2017-02-07 23 views
0

私はチェックスタイルプラグインをカスタムチェックスタイルファイルcheckstyle.xmlと一緒に使用しようとしています。 I have followed the guideMaven checkstyleプラグイン。 CheckstyleException:モジュール 'ParameterName'の 'accessModifiers'プロパティが存在しません

... 
<reporting> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-checkstyle-plugin</artifactId> 
      <version>2.17</version> 
      <configuration> 
       <configLocation>src/main/resources/checkstyle.xml</configLocation> 
      </configuration> 
      <reportSets> 
       <reportSet> 
        <reports> 
         <report>checkstyle</report> 
        </reports> 
       </reportSet> 
      </reportSets> 
     </plugin> 
    </plugins> 
</reporting> 
... 

checksyle.xmlは(私は、ファイルの名前を変更しました)the google checkstyle fileです:これは私のPOMです。

Caused by: org.apache.maven.reporting.MavenReportException: Failed during checkstyle configuration 
at org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.executeReport(AbstractCheckstyleReport.java:488) 
at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:154) 
at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255) 
at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:219) 
... 26 more 
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker - Property 'accessModifiers' in module ParameterName does not exist, please check the documentation 
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:168) 
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:137) 
at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:218) 
at org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.executeReport(AbstractCheckstyleReport.java:473) 
... 29 more 
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property 'accessModifiers' in module ParameterName does not exist, please check the documentation 
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:164) 
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:130) 
at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:177) 
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:137) 
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:163) 
... 32 more 

私はCheckstyleのファイルをチェックし、私が定義されてaccessModifiers性質を持っている:問題は、私はmvn -X siteを実行したときに、私は次のエラーを取得し、ということです。

.... 
<module name="ParameterName"> 
    <property name="id" value="ParameterNameNonPublic"/> 
    <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> 
    <property name="accessModifiers" value="protected, package, private"/> 
    <message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/> 
</module> 
<module name="ParameterName"> 
    <property name="id" value="ParameterNamePublic"/> 
    <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> 
    <property name="accessModifiers" value="public"/> 
    <message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/> 
</module> 

私が間違っていることは分かりません。

+0

'のCheckstyleを(その6.11.2 defualtによって)のCheckstyleプラグイン 定義内の最新バージョンを指定することができます。 xml 'は、このガイドの示唆です。 – nullpointer

+0

最近のcheckstyleプラグインでスコープを置き換えるためにaccessModifiersが導入されたようです。あなたがaccessModifiers要素を削除するとうまくいくのですか?また、最新のプラグインを使用してください(defualt 6.11.2のデフォルト設定)。以下のようにhttps://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html – Santo

+0

@nullpointerファイルはちょうど別の位置にあります。 – giuseta

答えて

0

accessmodifiersはcheckstyleリリース7.5でのみ導入されました。下記のリリースノートをご覧ください。 http://checkstyle.sourceforge.net/releasenotes.html

  1. あなたは によって古いバージョンaccessModifiersを削除し、代わりに範囲を追加することでモジュール定義を両立させることができます。
  2. 現在地述べたよう

https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading- checkstyle.html

https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html

+0

私は7.5バージョンで試しましたが、それでも動作しません。 – giuseta

+0

@giusetaどうやって7.5に変更していますか?依存関係を無効にするプラグイン管理を宣言していますか?私はそれを働かせることができる – Santo

+0

また私が尋ねた質問を見なさい、http://stackoverflow.com/questions/42121531/dependencies-added-in-pluginmanagement-not-considered-during-reporting/42122294#42122294 – Santo

関連する問題