title: How to included bundled rulesets in maven pmd plugin
body: <p>I have a custom ruleset definition that refers to a bunch of rules from bundled rulesets. However, I have problems with resolving these bundled rulesets in the maven pmd plugin. <a href="https://stackoverflow.com/questions/8389612/maven-pmd-plugin-uses-only-the-bundled-rulesets">Here</a> is a related question with a quick'n'dirty solution for this problem. However, I was wondering whether there might be a clean solution for this problem (because I think that this is a rather common usecase, or?).
  In the following I'm describing the attempts that I tried so far:</p>
  
  <pre><code>&lt;build&gt;
      &lt;pluginManagement&gt;
          &lt;plugins&gt;
  
  ...
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${maven-pmd-plugin.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;linkXref&gt;true&lt;/linkXref&gt;
                      &lt;rulesets&gt;
                          &lt;ruleset&gt;my_pmd_ruleset.xml&lt;/ruleset&gt;
                      &lt;/rulesets&gt;
                      &lt;failsOnError&gt;false&lt;/failsOnError&gt;
                      &lt;source&gt;${java.source.version}&lt;/source&gt;
                      &lt;target&gt;${java.source.version}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
  &lt;/build&gt;
  </code></pre>
  
  <ol>
  <li><p>I defined the maven pmd plugin (version 3.0.1) with my custom ruleset (and Java 1.6) in build/plugin management section of my parent pom as well as in the reporting section. I got many of the following warnings:</p>
  
  <pre><code> [WARNING] Failure executing PMD: Unable to find referenced rule UnusedModifier; 
   perhaps the rule name is mispelled?
  </code></pre></li>
  <li><p>I tried to refer to all utilised bundled rulesets:</p>
  
  <pre><code>&lt;build&gt;
  &lt;pluginManagement&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven-pmd-plugin.version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;linkXref&gt;true&lt;/linkXref&gt;
                  &lt;rulesets&gt;
                      &lt;ruleset&gt;rulesets/java/coupling.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/design.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/controversial.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/codesize.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/clone.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/braces.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/basic.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/finalizers.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/imports.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/unit.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/logging-jakarta-commons.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/logging-java.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/migrating.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/naming.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/optimizations.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/strictexception.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/strings.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/sunsecure.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/typeresolution.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;rulesets/java/unusedcode.xml&lt;/ruleset&gt;
                      &lt;ruleset&gt;my_pmd_ruleset.xml&lt;/ruleset&gt;
                  &lt;/rulesets&gt;
                  &lt;failsOnError&gt;false&lt;/failsOnError&gt;
                  &lt;source&gt;${java.source.version}&lt;/source&gt;
                  &lt;target&gt;${java.source.version}&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/pluginManagement&gt;
  &lt;/build&gt;
  </code></pre></li>
  </ol>
  
  <p>There I'm getting always the following error:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.0.1:pmd (pmd) on project my_project: An error has occurred in PMD Report report generation. Could not find resource 'rulesets/java/unit.xml'
  </code></pre>
  
  <p>The maven pmd plugin depends on pmd, so the bundled rulesets should be part of the classpath, or? The <a href="http://maven.apache.org/plugins/maven-pmd-plugin/examples/usingRuleSets.html" rel="nofollow noreferrer">Maven pmd plugin manual</a> says that bundled rulesets should be defined with a relative path and custom rulesets with an absolute path. However, I think that it can also read my custom ruleset via a relative path, because it is part of the classpath.
  I also tried other thing, e.g., explicit additional dependency definition of pmd in the maven pmd plugin. However, without any success so far :\</p>