I’m using the pmd plugin on eclipse and I need to create my custom rules. I created my java class dependent on the AbstractJavaRule class and created my ruleset. But I can't import everything into pmd eclipse. I did a lot of research and tried different suggested solutions, but nothing worked. Here is what I tried:
- Window -> Preferences -> PMD -> Rules configuration -> Import ruleset
- Window -> Preferences -> PMD -> Rules configuration -> Add a rule
For this method I created a jar containing my java class defining my rule and my ruleset in different packages. I then edited the MANIFEST.MF files and placed my jar in the lib/ folder as described on this post: How to Add custom JAR to the "eclipse-pmd" plugin?
But after clicking add rule, when I enter my rule implementation class, I get an "invalid rule class" error.
- Right click on project -> Properties -> PMD -> Use the configured ruleset in a project file (and I chose my ruleset.xml present in the project)
- I also read this post : Adding new java based PMD rule in eclipse pmd plugin
Neither method worked.
If you have an idea to help me solve my problem, I’m interested.