2017-05-09 51 views
1

だからここに私のcaseで、checkstyle-suppressions.xmlはcheckstyle.xmlとのpom.xmlの両方に指定されています。定義の抑圧フィルタ - のmaven-のCheckstyleプラグイン

checkstyle.xml:

<module name="SuppressionFilter"> 
     <property name="file" value="checkstyle-suppressions.xml"/> 
</module> 

のpom.xml

<project> 
    <reporting> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-checkstyle-plugin</artifactId> 
      <version>2.17</version> 
      <configuration> 
       <configLocation>checkstyle.xml</configLocation> 
       <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation> 
      </configuration> 
      </plugin> 
     </plugins> 
     </reporting> 
    </project> 

私はQUありませんよ両方のファイルで定義する必要があるかどうか確かめてください.1つはSuppressionFilterモジュールで、もう1つはpomの<suppressionsLocation>タグです。

他のプロジェクトでもhttps://github.com/openmrs/openmrs-core/blob/master/checkstyle.xmlを使用します。 pom.xmlにhttps://github.com/openmrs/openmrs-core/blob/master/checkstyle.xml<configLocation>設定してそうしかし、Checkstyleは、プラグインがエラーで失敗します。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter: InvocationTargetException: Unable to find: checkstyle-suppressions.xml -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration 

Caused by: org.apache.maven.plugin.MojoExecutionException: Failed during checkstyle configuration 

Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter 

Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter 

答えて

0

I'm not quite sure whether there's the need to define it in both files

必要がありませんが。 POMで定義されている場合、mavenはそれをシーンの背後の設定に追加します。

Failed during checkstyle configuration
Unable to find: checkstyle-suppressions.xml

ロードするファイルが見つかりませんでした。
ファイルを直接ファイルシステムのパス(相対パスは現在の作業ディレクトリに基づいている必要があります)、URL、またはプログラム内のリソースとして検索しようとします。 http://checkstyle.sourceforge.net/config_filters.html#SuppressionFilter

関連する問題