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?
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!
styleguide.css
, but that failed. –
Bolt 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 selectCheckstyle -> Create Formatter-Profile
. The following files will be created in you project:
my-project-cs-cleanup.xml
my-project-cs-formatter.xml
- Add the generated
my-project-cs-formatter.xml
as a formatter:Windows -> Preferences -> Java -> Code Style -> Formatter -> Import
© 2022 - 2024 — McMap. All rights reserved.