Menu

Custom rule in PMD for java.

2017-09-26
2017-09-26
  • Paras Singla

    Paras Singla - 2017-09-26

    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?

     
  • Andreas Dangel

    Andreas Dangel - 2017-09-29

    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/

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.