maven-pmd-plugin に、指定したルールセットを含め、いくつかのルールを除外したい (具体的には、UselessParentheses)
ドキュメントで説明されているように、すべてのモジュールの親である pmd.xml に以下を配置しました。
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0</version>
<configuration>
<rulesets>
<ruleset>/home/ubuntu/ruleset.xml</ruleset>
</rulesets>
</configuration>
</plugin>
</plugins>
</reporting>
そして、次のようなカスタム ルールセットを用意しました。
<!-- We'll use the entire rulesets -->
<rule ref="rulesets/java/basic.xml"/>
<rule ref="rulesets/java/imports.xml"/>
<rule ref="rulesets/java/codesize.xml"/>
<rule ref="rulesets/java/design.xml"/>
<rule ref="rulesets/java/strings.xml"/>
<rule ref="rulesets/java/unusedcode.xml"/>
<!-- We want everything from this except some -->
<rule ref="rulesets/java/unnecessary.xml">
<exclude name="UselessParentheses"/>
</rule>
メインパーツとして。
それにもかかわらず、実行するmvn clean jxr:jxr pmd:check
と、レポートに「UselessParentheses」が表示されます。さらに、-X
ショーでそれを実行する
[DEBUG] Preparing ruleset: java-basic
[DEBUG] Before: java-basic After: java-basic.xml
[DEBUG] The resource 'rulesets/java/basic.xml' was found as jar:file:/home/ubuntu/.m2/repository/net/sourceforge/pmd/pmd/5.0.2/pmd-5.0.2.jar!/rulesets/java/basic.xml.
[DEBUG] Preparing ruleset: java-unusedcode
[DEBUG] Before: java-unusedcode After: java-unusedcode.xml
[DEBUG] The resource 'rulesets/java/unusedcode.xml' was found as jar:file:/home/ubuntu/.m2/repository/net/sourceforge/pmd/pmd/5.0.2/pmd-5.0.2.jar!/rulesets/java/unusedcode.xml.
[DEBUG] Preparing ruleset: java-imports
[DEBUG] Before: java-imports After: java-imports.xml
[DEBUG] The resource 'rulesets/java/imports.xml' was found as jar:file:/home/ubuntu/.m2/repository/net/sourceforge/pmd/pmd/5.0.2/pmd-5.0.2.jar!/rulesets/java/imports.xml.
したがって、pmd はカスタム ルールセットを無視したようです。
カスタム ルールセットを機能させたい。私は何を間違っていますか?