Stephen has nearly twenty years experience in software development. He is involved in a number of open source projects including Jenkins. Stephen was one of the first non-Sun committers to the Jenkins project and is the person directly responsible for the weather icons. Stephen lives in Dublin, Ireland - where the weather icons are particularly useful. Follow Stephen on Twitter and on his blog.
- Go to your Jenkins instances root page.
- If your Jenkins instance has security enabled, login as a user who has the Overall | Administer permission.
- Select the Manage Jenkins link on the left-hand side of the screen.
- Select the Manage Plugins link.
- On the Available tab, select the PMD Plugin and click the Download and Install button at the bottom of the page. (All the required dependent plugins will automatically be downloaded for you.)
- (If you are using a version of Jenkins prior to 1.442) Restart Jenkins once the plugins are downloaded.
Tips & Tricks
- By default, the plugin only runs for stable or unstable builds (on the assumption that you only run the PMD reports when the code compiles). If you need the reports to be collected for every build, just enable the Run always option.
- If you are using a Freestyle project with an ANT or Maven multi-module project, you may want to see the reports broken down by module. You can ask the plugin to try and auto-detect the modular structure of your build by enabling the Detect modules option.
- You have a project with 10,000 PMD errors. You don't want to fix all of them this sprint, but you want to make some progress, i.e. get down to 9,500 -- you certainly don't want things getting worse. The solution here is to use a mix of the Health and Status thresholds:
- Set 0% health to the current number of PMD errors, e.g. 10,000. Set 100% health to somewhere between 20 and 50% better than your target, e.g. 9,300. Set the status thresholds so that unstable is about 10% of your target, e.g. 9,950, and failed is slightly worse than where you are, e.g. 10,001:
- The result will be that developers will be prodded into fixing some PMD issues (as the build will be called out as unstable) and prevented from letting things get worse (as the build will be marked as failed if that happens) and once some progress has been made, the weather reports will start to improve, giving a nice subtle nudge... just the kind of positive feedback that works.
- The PMD plugin can be somewhat demanding on memory, if your project has a very large number of PMD violations, you may have to resort to either fixing a large chunk of them or switching to the Violations plugin which uses a different parsing engine and usually maintains a lower memory footprint.