Solved:
<dependency>
<groupId>pmd.rules</groupId>
<artifactId>CustomJavaRules</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>path/to/my/jar/CustomJavaRules.jar</systemPath>
</dependency>
Question
I've wrote a custom rule for pmd (in java). I want this rule to be executed in my project. I've added my rule to pmd.xml:
<rule name="MyRule"
message="some message"
class="MyRule">
<description>
some description
</description>
<properties>
<property name="someproperty" value="1" />
</properties>
<priority>3</priority>
</rule>
And there the problem appeared. I didn't know where to place the rule definition - MyRule.class. I was trying to add a maven dependency to pmd:
<dependency>
<groupId>pmd.rules</groupId>
<artifactId>CustomJavaRules</artifactId>
<version>1.0</version>
</dependency>
where CustomJavaRules is a jar artifact (from local "file://" repo) containing MyRule.class. The jar is found and loaded but MyRule.class is still invisible for pmd.
I was trying to place the class in various directories... with poor results.
Has anyone ever had a similar problem?
Solution
Solved:
<dependency>
<groupId>pmd.rules</groupId>
<artifactId>CustomJavaRules</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>path/to/my/jar/CustomJavaRules.jar</systemPath>
</dependency>