简体   繁体   中英

Generate a summary with the Maven PMD plugin

I am using the Maven PMD plugin as a part of the Maven Site Plugin to generate a PMD report. This works in general, but when I did my PMD reports with Ant, there was always a violation summary at the top of the report, listing the number of files with errors, the number of violations in total and the number of violations for each priority (1 to 5). With Maven and the Maven PMD plugin, there is no such summary, the report starts directly with the detailed list of files, and there is no display of the violation priority. The example report shown at the PMD Sourceforge site at least shows a general summary of files and errors, but also not with any priority information.

Is there any way to show this information with the Maven PMD plugin?

As there didn't seem to be a direct solution, I made a workaround. The Maven PMD plugin itself is used to generate the XML report as part of the site report. Afterwards the XML Maven plugin is used with a XSLT from our old Ant-based configuration to transform the XML report and overwrite the site report for PMD. Not really clean, but it's working. Note that contrary to what I thought initially, Ant itself also did not print the reports as intended, a former co-worker added the XSLT to the old Ant target.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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