I am trying to write a new rule for java for a specific project by extending the AbstractRule class.
The only way to add this new rule with the existing rules in PMD is to download the entire PMD source code and add the new class in there?
Or Is there any other simpler way to achieve this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is. You can develop your custom rule outside the PMD tree and use PMD as a dependency (you only need the jar files).
When running PMD at the end, you'll need to make sure, both PMD and your custom rule are on the classpath (either let maven do this for you or drop your own jar-file into PMD's lib folder).
Hi,
I am trying to write a new rule for java for a specific project by extending the AbstractRule class.
The only way to add this new rule with the existing rules in PMD is to download the entire PMD source code and add the new class in there?
Or Is there any other simpler way to achieve this?
There is. You can develop your custom rule outside the PMD tree and use PMD as a dependency (you only need the jar files).
When running PMD at the end, you'll need to make sure, both PMD and your custom rule are on the classpath (either let maven do this for you or drop your own jar-file into PMD's lib folder).
See also the other thread: https://sourceforge.net/p/pmd/discussion/188192/thread/499932fc/