私はチェックスタイルプラグインをカスタムチェックスタイルファイルcheckstyle.xml
と一緒に使用しようとしています。 I have followed the guide。Maven 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>
私が間違っていることは分かりません。
'のCheckstyleを(その6.11.2 defualtによって)のCheckstyleプラグイン 定義内の最新バージョンを指定することができます。 xml configLocation> 'は、このガイドの示唆です。 –
nullpointer
最近のcheckstyleプラグインでスコープを置き換えるためにaccessModifiersが導入されたようです。あなたがaccessModifiers要素を削除するとうまくいくのですか?また、最新のプラグインを使用してください(defualt 6.11.2のデフォルト設定)。以下のようにhttps://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html – Santo
@nullpointerファイルはちょうど別の位置にあります。 – giuseta