In my previous post, I have complained about Maven plugins that do not release new versions although there are blocking issues that are reported in Jira with patches attached to them. If you don't want to wait any longer for a new plugin release, just build one on your own. Here's how we usually do that.
Fix the Plugin
- Checkout plugin sources from source repository and import as Eclipse project. The easiest way to do this is to use m2eclipse plugin's cool "Materialize Maven Projects" feature (see here).
- Edit the POM and change the plugin's version number (see notes below).
- Download the patch from the JIRA issue page.
- Appy the patch using Eclipse: in project's context menu, select Team > Apply Patch...
- Now build, unit-test and install the plugin using Maven.
- Update your project's POM to use this new version, and test, test, test....
- If everything is fine, upload your patched plugin to your repository manager to make it available to your team members.
- Check in all changes you made, probably including the fixed plugin – into your repository, of course, not the plugin's one!
Give Some Thought to Version Numbers
A few rules on the fixed plugin's version string that have proven rational for us:
- You should not just increase the version number to prevent mix-up with future official versions of the plugin.
- Instead, we usually add a suffix made up of our company name and a consecutive number, like "-fja-1" for the first fix. This indicates the initiator and gives room for further fixes in case they should be required. Additionally, you always see the underlying official version. Example:
<version>2.5-fja-1</version>for FJA's first fix of version 2.5.
- Don't change the plugin's group or artifact id because this would bypass Maven's version resolution, i.e. in Maven's eyes your fix would not just be a new version, but another plugin. You possibly end up having both plugins (the original one and your fix) configured in your builds, leading to duplicate execution and unexpected results.
- If you just change the version string, this can be done in the parent POM – you are locking down your plugins in your corporate/project root POM, do you? – making it easy to switch back to an official relase later... in case there is one available.