Use Jenkins' Warning plugin for CheckStlye, PMD and FindBugs reports example
Jenkins, CheckStyle, PMD and FindBugs
The FindBugs, PMD and CheckStyle Jenkins plugins have all been deprecated in favor of the Warnings Next Generation static code analysis report generation tool. So if you’re plan to upgrade to a newer version of the popular continuous integration tool, or you’re just confused over why you can’t find the CheckStyle Jenkins plugin in the CI tool’s management console, you’ll want to take note of the instructions provided here.
The role of Apache Maven in terms of Jenkins integration with PMD, FindBugs and Checkstyle remains the same. Any Jenkins run that intends to use these static code analysis tools will need to invoke these tools as part of the build with the following Maven call:
mvn install checkstyle:checkstyle pmd:pmd findbugs:findbugs
Jenkins’ Warning Next Generation plugin
However, without a Jenkins plugin to integrate the results of static code analysis into the build, the various XML, JSON and text files these tools crate will simply lie dormant on the filesystem. Unfortunately, the old FindBugs, PMD and CheckStyle plugins are deprecated. Fortunately, the three deprecated plugins have been replaced by one that is extensible and much easier to use.
|Your intro to GitHub Actions training course|
Here’s how to get started with GitHub Actions:
Follow these tutorials and you’ll learn GitHub Actions fast.
Install Jenkins’ Warnings Next Generation plugin from the management console and you will have a single Jenkins plugin capable of processing the results from all three tools.
FindBugs, PMD and CheckStyle Jenkins reports
With Warnings Next Generation plugin installed, a new post-build option named Record compiler warnings and static analysis results becomes available to all Jenkins build jobs. It provides a dropdown list from which hundreds of differing static code analysis tools can be chose, including CheckStyle, PMD and FindBugs. The build step only needs to be added to the Jenkins job once, after which the Add Tool button can be used to add additional reports.
Jenkins static code analysis reports
With the various static code analysis tools added to the Jenkins Warnings Next Generation plugin, reports for each will be displayed in the status window of the build job.
The reports look and behave exactly the same way the deprecated CheckStyle, PMD and FindBugs plugins did, so DevOps professionals familiar with the former mode of integration won’t encounter any learning cure processing the results. And those new to static code analysis in Jenkins will find the feedback and insight into the quality of their code profoundly helpful.