Menu

Custom ruleset not working

Mansi Deo
2015-06-17
2015-06-20
  • Mansi Deo

    Mansi Deo - 2015-06-17

    I am trying to make a custom ruleset work for plsql packages and use them through command line.

    I downloaded the pmd src code, opened it in eclipse, added my custom ruleset to the ruleset folder along with other rulesets and added its path to the comma separated list. Compiled the project and exported it as a jar(there were some exceptions but no errors) to the pmd-bin-5.3.2/lib folder, replacing the older one.

    No ruleset, not even the standard one is being recognized and it throws a "Ruleset Not Found" error.

    Tried removing my changes(making it like it was before), recompiling and exporting the jar, doesn't work.
    when I keep the original jar in lib, the standard rulesets work. But when the src code is opened and compiled, something gets messed up.

    Can anybody please suggest a way to make this work?

     
  • Andreas Dangel

    Andreas Dangel - 2015-06-20

    Hi, the safest way to do this is, to use maven. You can then easily compile the distribution and get an ready-to-ship zip file:

    mvn clean package
    

    The zip-file will be in the directory pmd-dist/target.

    While you can use eclipse to modify stuff, simply take maven to create the package.

    But maybe, there is an easier way to do... What kind of custom rules do you have? Are they java-based or XPath based? If they are xpath based, you could reference the ruleset with an absolute file:/// URL at the command line...
    If they are java based, then it needs to be on the classpath...

    You can also take a look at https://sourceforge.net/p/pmd/discussion/188194/thread/cf16c9cb/#bb63 where you can see, how to create an own module separate from pmd - which you can then simply drop into the lib folder additionally. No need to recompile the complete pmd distribution....

     

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.