【发布时间】:2015-04-07 13:30:22
【问题描述】:
我正在尝试执行此处显示的示例
http://pmd.sourceforge.net/pmd-5.3.0/customizing/howtowritearule.html
显示未找到WhileLoopsMustUseBracesRule 类[我相信这是初学者的标准问题之一]
方法试过了:
1) cd pmd-5.3.0
2) created WhileLoopsMustUseBracesRule.java and ruleset.xml as per shown in the page.
3) javac -cp [all the required jar files seperated by ; since it is windows pc ] WhileLoopsMustUseBracesRule.java
4) bin/pmd.bat -d [code on which pmd has to check the rule] -f xml -R ruleset.xml
上面的步骤给了我没有找到类的错误,这里开发人员评论说这些步骤有效 [http://sourceforge.net/p/pmd/discussion/188192/thread/7a34d224/]
如果我遗漏了什么,请告诉我。
我也尝试将类文件直接添加到类路径中 其他方法尝试:
1) compiled the WhileLoopsMustUseBracesRule.java file and got the .class file.
2) created a jar using jar -cf jar_name jar_file command
3) added that jar file in the class path , using set CLASSPATH and also tried adding directly in the batch file used to run PMD i.e. pmd.bat
请帮忙!
【问题讨论】: