简体   繁体   English

保存PMD Eclipse插件的输出

[英]Save output from PMD Eclipse plugin

I know PMD can be exectued on command line and an output file specified there, but for certain reasons simply saving the Eclipse plugin results to a file would make life easier. 我知道PMD可以在命令行上执行,并在其中指定输出文件,但是出于某些原因,将Eclipse插件结果保存到文件中将使工作变得更加轻松。

Is there any way to do this? 有什么办法吗? I've hunted around for this but haven't found a solution. 我一直在寻找这个,但是没有找到解决方案。

This functionality is a bit hidden, but it exists. 此功能有些隐藏,但存在。

  1. Go to "Window -> Preferences -> PMD -> Reports" and select the report format, you want, eg "text". 转到“窗口->首选项-> PMD->报告”,然后选择所需的报告格式,例如“文本”。
  2. Right-click on the project and select "PMD -> Check Code". 右键单击项目,然后选择“ PMD->检查代码”。
  3. Right-click on the project and select "PMD -> Generate Reports". 右键单击项目,然后选择“ PMD->生成报告”。

Now, you should have a new folder reports in your project, which contains a file pmd-report.txt . 现在,您应该在项目中有一个新的文件夹reports ,其中包含文件pmd-report.txt

It seems, that a report is only created, if there are violations, hence the 2nd step (eg there must be at least one violation marked in the project). 似乎只有在存在违规的情况下才创建报告,因此是第二步(例如,项目中必须至少有一个违规标记)。

Edit : This assumes, you are using the pmd-eclipse plugin from this update site: https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/ - note, there is also an alternative eclipse-pmd plugin available. 编辑 :假设您正在使用此更新站点上的pmd-eclipse插件: https : //sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/-注意,还有一个替代的eclipse-提供了pmd插件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM