Designer.bat is file is not generating xpath expression #3035
-
Hi Github, |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments
-
Hi @RaheemShaik999, Please note, the designer can't generate an xpath expression for you - you'll need to write the expression yourself. It however assists you in writing it (via auto complete). |
Beta Was this translation helpful? Give feedback.
-
@andreas, Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi @RaheemShaik999, A example for a custom java-based rule can be found here: https://github.com/pmd/pmd-examples |
Beta Was this translation helpful? Give feedback.
-
I went through your example project, when i try to setup the project what you provided by using cmd. It is showing following errors:
|
Beta Was this translation helpful? Give feedback.
-
Hi, yes, I've checked it - there were a couple of errors (I've just fixed them now in the readme):
Here are the whole changes: pmd/pmd-examples@74e40b9#diff-8c9691456fd6146cb1ee643c976b041a |
Beta Was this translation helpful? Give feedback.
-
Hi...I am running rules by using cmd.
|
Beta Was this translation helpful? Give feedback.
-
Okay, extending |
Beta Was this translation helpful? Give feedback.
-
Ok...but in the MyRule.java, following packages where I can get: import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; |
Beta Was this translation helpful? Give feedback.
-
You can also use https://github.com/pmd/pmd-examples/tree/master/custom-rule-with-maven and import this with your favorite Java IDE (eclipse, intellij, netbeans, ...) |
Beta Was this translation helpful? Give feedback.
-
I have used the above project as u mentioned, but it is showing the following error: pmd.bat file contains the following: |
Beta Was this translation helpful? Give feedback.
-
Can you modify the file The error "could not find or load main class net.sourceforge.pmd.PMD" means, that the "classpath" argument is wrong. It should point to the lib-subfolder in the directory, where you have extracted the pmd zip file, so that java finds all the jar files. In your case, it should be |
Beta Was this translation helpful? Give feedback.
-
Thanks for your suggestion,,.
My folder structure is like: |
Beta Was this translation helpful? Give feedback.
-
Hi @RaheemShaik999 , do you still have this issue? |
Beta Was this translation helpful? Give feedback.
-
If you still have trouble running PMD, please open a new issue. |
Beta Was this translation helpful? Give feedback.
Hi @RaheemShaik999,
you're right, there are two ways of writing custom rules: XPath based rules and Java Rules. They are described in our documentation here: https://pmd.github.io/pmd-6.7.0/pmd_userdocs_extending_writing_pmd_rules.html and https://pmd.github.io/pmd-6.7.0/pmd_userdocs_extending_writing_xpath_rules.html .
XPath rules are usually simpler (e.g. they cannot maintain state) and Java-based rules are most flexible. XPath rules can be used easier in a custom ruleset, since the rule is entirely defined in XML. See also our doc on custom rulesets: https://pmd.github.io/pmd-6.7.0/pmd_userdocs_making_rulesets.html
A example for a custom java-based rule can be found here: https://githu…