[英]Can I run PMD analysis in a Junit test?
I would like to create an automated junit test that passes if my code meets the requirements specified by PMD, and fails if it does not. 我想创建一个自动化的junit测试,如果我的代码满足PMD指定的要求,则通过,如果不满足,则失败。 Is this possible?
这可能吗?
It is possible tu run a PMD analysis in a JUnit test. 您可以在JUnit测试中运行PMD分析。 However, there exist PMD plugins for every Java IDE, build and CI tool out there.
但是,每个Java IDE,构建和CI工具都有PMD插件。 Are you sure they don't already do what you want to achieve?
您确定他们还没有做您想实现的目标吗?
If you still want to do it yourself, take a look at the class PMD. 如果您仍然想自己做,请查看PMD类。 It has the static method PMD.doPMD(configuration) which starts the analysis.
它具有启动分析的静态方法PMD.doPMD(configuration) 。
The same class also contains the main method in case you want to start it like from the command line. 如果您想从命令行启动它,则同一类还包含main方法 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.