What java formatter do you use for formatting source code?
Ctrl+Alt+L
More on reddit.comcoding style - Stand-alone Java code formatter/beautifier/pretty printer? - Stack Overflow
Codestyle and formatters
Strict Code Formatter
How does a code formatter work?
Why might the formatter report an error?
How do I format code on this page?
I am setting up my java IDE with neovim, and I am searching for a good formatter. I have came across google-java-format, yet I want to know if there is any other alternative?
JIndent (Commercial) does what you want:
http://www.jindent.com/
I've also used Jalopy in the past to do this, it's open source:
http://jalopy.sourceforge.net/
EDIT: I will note that Jalopy is fairly old and there doesn't seem to be any recent updates to it. I'm not quite sure if it will work with Java 5/6. You might want to look at Jacobe instead:
http://www.tiobe.com/index.php/content/products/jacobe/Jacobe.html
There's also a more complete list of formatters here on Roedy Green's site:
http://mindprod.com/jgloss/beautifier.html
You can also run Eclipse reformatter from command line.
Here is the Eclipse documentation of the feature
First you have to create configuration file specific to your project of your Java code formatter settings.
Then save {projectDirectory}/.settings/org.eclipse.jdt.core.prefs to another location.
Now you will call the formatter.
"c:\path\to\eclipse\eclipse.exe" -vm "C:\path\to\jdk\bin\java.exe" -application org.eclipse.jdt.core.JavaCodeFormatter -config "c:\path\to\org.eclipse.jdt.core.prefs" "C:\path\to\your\src"
[WARNING] This seems to have stopped working in Eclipse 2018. Use Eclipse Oxygen.
Hi y'all,
My team would like to standardise code formatting and enforce it in CI. We've tried google-java-formatter but it doesn't look nearly as good as inteliJ's default settings.
Ideally, we'd like to export inteliJs defaults (to have the benefits of built in formatter) and use something that would enforce it on CI build. Has anyone done it? What are your pipelines like? Any tips and tricks?