Social Media

Category Archives for BuildTools

Applying Eclipse formatting using Maven

I had an issue recently where a branch had been formatted by eclipse and made a merge from Trunk to Branch reasonably difficult. These things happen – so the solution was to find a plugin that would allow me to format both HEAD and Branch consistently outside of eclipse.

The first step was to export my eclipse preferences from eclipse –

Preferences > Java > Code Style > Formatter

Eclipse Preferences

Eclipse Preferences

The next step was to find a plugin that would apply these changes. I opted for formatter-maven-plugin

Then it was a matter of adding it to both master poms –

Then run the plugin on both branch and trunk –

Commit then continue with your merge