Friday, December 12, 2008

Maven, Eclipse, Checkstyle, PMD, Oy, Vey.

Code quality is a wonderful thing. You can run PMD and Checkstyle to enforce consistency check for inconsistencies and problems.

If you're like me, however, you really hate to edit for two hours and then get handed a long list of complaints. Or, worse, to ask your IDE to neaten up the code and find out that it's been 'neatened' to the tune of 100 Checkstyle complaints.

I use Eclipse. Eclipse has plugins for Checkstyle and PMD, and a highly configurable set of tools for formatting and code cleanup. Configurable is nice, but it's a tiresome process to establish the right configuration for all my projects and workspaces.

I wish that there was some automatic way to decorate an Eclipse workspace with all the right settings to match up with how some project uses Checkstyle and PMD.

Luckily for me, Dan Kulp of the Apache CXF Project did a vast job of reverse engineering to figure out how all the Eclipse configuration works. The Maven POMs for CXF arrange for the same Checkstyle and PMD configurations to be used for Maven and Eclipse, and set up the Eclipse formatting and cleanup options to match.

I did a bit of reverse engineering of Dan's reverse engineering here.

Aside from the goodness of this when working on CXF, I was able in an hour of so of work to adapt it to my day job.

No comments:

Analytics