Uploaded image for project: 'Maven PMD Plugin'
  1. Maven PMD Plugin
  2. MPMD-371

Using two ruleset files with same name in different directories

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.20.0
    • 3.21.1, 3.21.2
    • PMD
    • None

    Description

      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.)

       

      <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>

       

      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(...)

      Attachments

        Issue Links

          Activity

            People

              adangel Andreas Dangel
              brunoharbulot Bruno Harbulot
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: