You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Bruno Harbulot (Jira)" <ji...@apache.org> on 2023/05/08 17:17:00 UTC

[jira] [Updated] (MPMD-371) Using two ruleset files with same name in different directories

     [ https://issues.apache.org/jira/browse/MPMD-371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruno Harbulot updated MPMD-371:
--------------------------------
    Summary: Using two ruleset files with same name in different directories  (was: Cannot use two ruleset files with same name in different directories)

> Using 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
>            Priority: Major
>
> 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)