What java formatter do you use for formatting source code?

This page summarizes the projects mentioned and recommended in the original post on /r/java

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • google-java-format

    Reformats Java source code to comply with Google Java Style.

  • 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?

  • formatter-maven-plugin

    Formatter Maven Plugin

  • I've been partial to revlc/formatter-maven-plugin for some time

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • fmt-maven-plugin

    Opinionated Maven Plugin that formats your Java code.

  • Coveo is another one that's easier to set up because /drumroll - there are no configurations at all. It uses the google java format which, as /u/dpash pointed out in his response has 2 space indentation and comically short lines. I'm not advocating 300 line lengths or anything, but google's style is very rigid in that regard. I've actually gotten used to the 2 space thing.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts