Reputation: 22914
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?
Upvotes: 47
Views: 32545
Reputation: 692
The answer currently marked as accepted does not work as is with Eclipse 2022-06
and Checkstyle Plug-in 10.0.0
. These are the steps that worked for me:
Install Checkstyle plug-in
Import Checkstyle configuration: Windows -> Preferences -> Checkstyle -> New
. Choose "external file" as the type.
Right-click on your project in the Package view
and select Checkstyle -> Create Formatter-Profile
. The following files will be created in you project:
my-project-cs-cleanup.xml
my-project-cs-formatter.xml
my-project-cs-formatter.xml
as a formatter: Windows -> Preferences -> Java -> Code Style -> Formatter -> Import
Upvotes: 5
Reputation: 2338
In Eclipse (3.6):
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!
Upvotes: 80