2016-06-30 10 views
0

PMDの除外作業を行うことができません。私は以下のディレクトリ構造にあるgenerated-sourcesフォルダを除外する必要があります:pmdで除外しない

mainProject> subProject> target> generated-sources

下図のように私は、ルールセットを試してみました:

<exclude-pattern>.*/generated-sources/*.java</exclude-pattern> 
<exclude-pattern>.*/generated-sources/.*</exclude-pattern> 

私はまた、彼らのドキュメントを通じて&他のスタックオーバーフローのリンクを行っているが、何も助けていないようにみえます。私はmaven-pmd-plugin 3.1 & 3.6バージョンを試しました。試してみました

その他のオプション:

<!-- <excludeRoots> 
    <excludeRoot>target/generated-sources/**</excludeRoot> 
</excludeRoots> --> 
<!-- <excludes> 
    <exclude>target/generated-sources/*.*</exclude> 
</excludes> --> 
<!-- <excludeRoots> 
    <excludeRoot>target/generated-sources/**</excludeRoot> 
</excludeRoots> --> 
<!-- <excludes> 
    <exclude>${basedir}/target/generated-sources/*.java</exclude> 
</excludes> --> 
<!-- <excludeRoots> 
    <excludeRoot>${basedir}/target/generated-sources/**</excludeRoot> 
</excludeRoots> --> 
<!-- <excludes> 
    <exclude>**/generated-sources/**/*.java</exclude> 
</excludes> --> 
<excludeRoots> 
    <excludeRoot>target/generated-sources</excludeRoot> 
</excludeRoots> 

すべてのこれらの変更は、親POMに行われます。

答えて

2

を、excludeRootsは、例えばのためcompileSourceRootsに記載されている完全なフォルダ名と一致する必要があります

[DEBUG](F)compileSourceRoots = [プロジェクト/ SRC /メイン/ Java(登録商標)、プロジェクト/目標/生成され、ソース/ antlr4、プロジェクト/目標/生成され、ソース/注釈]

[DEBUG](F )excludeRoots = [プロジェクト/ターゲット/生成-ソース/ antlr4、プロジェクト/ターゲット/生成-ソース/注釈]

子で、プラグインの定義も、あなたの応答を

 <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-pmd-plugin</artifactId> 
      <configuration> 
       <excludeRoots> 
        <excludeRoot>target/generated-sources/antlr4</excludeRoot> 
        <excludeRoot>target/generated-sources/annotations</excludeRoot> 
       </excludeRoots> 
      </configuration> 
     </plugin> 
+0

Damianに感謝します!これは機能します。 – Karthik

0

excludeRootsパラメータを使用してこれを行うことができます。これにより、PMDレポートおよびその後のチェックからソースディレクトリを除外することができます。 MavenのsubProjectの設定例は次のようになります。あなたの子供のポンポンで

<plugin> 
    <artifactId>maven-pmd-plugin</artifactId> 
    <version>3.6</version> 
    <configuration> 
    <excludeRoots> 
     <excludeRoot>target/generated-sources</excludeRoot> 
    </excludeRoots> 
    </configuration> 
</plugin> 
+0

おかげのように見えるだろうがこれは役に立たなかった。私は試したことで質問を更新しました。 – Karthik

+0

@Karthikはこれを 'subProject' POMに入れましたか? 'mvn clean install pmd:pmd pmd:check'でMavenを実行します。 – Tunaki

+0

いいえ、これは親POMにあります。このコマンドを実行しても効果はありませんでした。 – Karthik

関連する問題