Bruno Harbulot created MPMD-371:
-----------------------------------
Summary: Cannot use two ruleset files with same name in different
directories
Key: MPMD-371
URL: https://issues.apache.org/jira/browse/MPMD-371
Project: Maven PMD Plugin
Issue Type: Bug
Components: PMD
Affects Versions: 3.20.0
Reporter: Bruno Harbulot
It is not possible to rely on two ruleset files that share the same filename
(but are located in different directories).
Here is an sample configuration for a multi-module project where there is a
common {{pmd-ruleset.xml}} file in the parent project and a {{pmd-ruleset.xml}}
file in each sub-module. (This is not limited to multi-module projects, it
could be any configuration where the same filename is used in different
directories.)
{code:java}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${pmd-maven-plugin.version}</version>
<configuration>
<rulesets>
<ruleset>${project.basedir}/pmd-ruleset.xml</ruleset>
<ruleset>${project-root.basedir}/pmd-ruleset.xml</ruleset>
</rulesets>
</configuration>
</plugin>{code}
The files specified in the {{<ruleset />}} elements are copied into
{{{}${project.build.directory}/pmd/rulesets{}}}, but only the actual filename
is taken into account during the copy, so the second copy overwrites the first.
This seems to be due to the implementation of
{{PmdReport.resolveRulesets(...)}} and {{PmdReport.getLocationTemp(...)}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)