In our organization, we have our builds set up so that they fail even if the source has one PMD/Checkstyle error. Until recently, I'm used to running formatter, clean-up and removing unused import options (available via right click context menu) before committing my source code, so that I don't break the build. You could also have clean-up do formatting and remove unused imports as part of clean-up. If you don't know what I'm talking about, look at formatter and clean-up options under Java->Code Style preferences.
How to automate?
While this is good, I recently found that I can automate this. Go to Window->Preferences->Java->Editor->Save Actions preferences page. Here there are options so that formatter, clean up and removing unused imports all run automatically whenever the source code is saved.
In save actions preferences page, Check "Perform the selected actions on save" to enable the other options below. Check "Format source code" and make sure to select "Format edited lines" option so that only the lines you edit are formatted. This would avoid formatter changing every line in the file. Check on "Organize imports" and also check on "Additional Actions". The actions here are (almost) same as the clean-up options available under Java->Code Style->Clean Up preferences. Click on configure button in "Additional Actions" and make sure that they both have the same configuration. Only thing missing here (which would have been really nice!) is that the additional actions does not automatically point to the clean up preferences defined already and so you have to define it again here. Also, you cannot use a clean-up profile here either. But, still the automatic save actions really save me time and makes sure that my code is always clean. Finally, the main thing is, I break our builds much fewer now!