How to generate an Eclipse formatter configuration from a checkstyle configuration?
27,977
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!
Author by
Ken Liu
Director of Engineering at Cockroach Labs. Github: kenliu Twitter: @kenliu
Updated on April 28, 2020Comments
-
Ken Liu about 4 years
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?
-
Jean-Rémy Revy over 8 yearsDear Ken, some of us think you really should accept the above answer as the best (not sure that Paul is running after the Unsung hero's badge ;))
-
Ken Liu over 8 years@Jean-RémyRevy done, thanks for the ping!
-
Vivek Chavda almost 7 years@Jean-RémyRevy It's good that the answer was accepted, but unsung hero would be for users that have accepted answers with 0 votes, rather than lots of votes without being accepted. (Just trying to save others from having to search what unsung hero badge means)
-
-
Robert Munteanu almost 15 yearsThere seems to be a problem with the generated links. After getting 'Bad Wiki Name', replace all %2B with +
-
Andreas Dolk almost 15 yearsSorry for this inconvenience - I added the full url to the answer.
-
Kevin Meredith about 10 yearswhich file should I import into the Eclipse check-style plug-in for the Google Java style - google-styleguide.googlecode.com/svn/trunk? I tried
styleguide.css
, but that failed. -
Paul about 10 years
-
Noumenon over 4 yearsThis feature is broken and the Eclipse plugin authors said in March 2019 that they were planning to remove it. stackoverflow.com/a/55323793/733092
-
Marco Bolis about 3 years@Noumenon is there an alternative AFAYK?
-
Noumenon about 3 years@MarcoBolis I never found one and just ran it from the command line.