I have a jar for custom PMD rules; it has Java classes and the XML rulesets.
The rulesets are in a top-level "/rulesets" dir.

I have the jar as a POM dependency:
    <dependency>
      <groupId>pmd</groupId>
      <artifactId>pmdcustomrules</artifactId>
      <version>1.2</version>
    </dependency>

I have the rulesets configured in the <reporting> section for the PMD
plugin:
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <configuration>
          <rulesets>
            <ruleset>/rulesets/pmdruleset.xml</ruleset>
            <ruleset>/rulesets/anotherset.xml</ruleset>
          </rulesets>
          <targetJdk>1.4</targetJdk>
        </configuration>
      </plugin>
    </plugins>

Running "mvn site" yields this error:
  Embedded error: Error rendering Maven report: Could not find resource
'/rulesets/pmdruleset.xml'.


Am I missing further configuration to get the custom rulesets on the
classpath?


The Maven PMD docs say rulesets are loadable from the classpath, so I assume
this is a feasible approach I am taking...
But the docs also say custom rulesets require an absolute path (which
contradicts loading from the classpath statement, unless it means only the
PMD jar rulesets).
Specifying a hardcoded path to the rulesets in the jar is not a "nice" thing
to do, as they are in a jar in the local repo!

The Maven PMD plugin version is 2.2.  I didn't see any JIRA issues that
address this problem in 2.2 or the forthcoming 2.3.

(I'm converting a product from m1 to m2.  This setup works nicely for m1 and
hope to do the same with m2.)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to