How to generate an Eclipse formatter configuration from a checkstyle configuration?

Ken Liu picture Ken Liu · Jun 12, 2009 · Viewed 26k times · Source

I have a checkstyle configuration XML file and want to automatically generate an Eclipse formatter configuration from this. Is there any tool that can do this?

Answer

Paul picture Paul · Mar 12, 2012

In Eclipse (3.6):

  • Install Checkstyle plug-in
  • Import stylesheet using Windows --> Preferences, General --> Checkstyle --> New. Since you have an external file, choose "external file" as the type.

Right-click on your project in the Package view and select Checkstyle --> Create Formatter-Profile.

Then enable the formatter for your workspace: Windows --> Preferences --> Java --> Code Style --> Formatter. Select formatter: "eclipse-cs [project name]".

Click OK!