A problem with formatting code on a branch, is when you come to merge it back to the trunk, you end up having to work thorough lots of file changes which are really only formatting changes. The larger your project size, the more work this involves. I was faced with a similar task recently.
While editing file by file, I usually do the Ctrl-A Ctrl-Shift-F combo to ensure the file is formatted according to our corporate standards before saving any edits. Since much of the code I touched on the branch was formatted under a different standard, and I touched a lot of files while introducing log4j logging, the end result was heading for a hairy merge. What I really needed was a way to bulk format both the branch and the trunk versions of the code-base.
Luckily, I realised that that same formatter embedded in Eclipse can be used to bulk format Java source. Here’s how …
