Gradle Format Plugin

A Gradle plugin to format Java source code
Alternatives To Gradle Format Plugin
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Typescript Eslint13,12764,39976,50315 hours ago1,852September 23, 2022383otherTypeScript
:sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript
Google Java Format4,89777912 days ago17March 07, 2022105otherJava
Reformats Java source code to comply with Google Java Style.
Unified3,71156,2401,26014 days ago51March 08, 20223mitJavaScript
☔️ interface for parsing, inspecting, transforming, and serializing content through syntax trees
Dokka2,876415 hours ago13June 19, 2022357apache-2.0Kotlin
API documentation engine for Kotlin
Clangformat Xcode2,790
2 years agoSeptember 26, 202232mitObjective-C
Xcode plug-in to to use clang-format from in Xcode and consistently format your code with Clang
Steal1,35969938910 months ago328June 09, 202284mitJavaScript
Gets JavaScript
2 days ago204mitKotlin
Plugin for IntelliJ IDEA that gives special support for Minecraft modding projects.
Moment Duration Format8421,9803733 years ago15June 05, 201930mitJavaScript
Format function plugin for the Moment Duration object.
Prettier Standard8199331,2392 years ago65July 08, 202016mitJavaScript
Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
3 days ago27otherJavaScript
:crystal_ball: Transform, query, and download geospatial data on the web.
Alternatives To Gradle Format Plugin
Select To Compare

Alternative Project Comparisons

Not (actively) maintained anymore, you might want to check out the Spotless Gradle plugin

Gradle Format plugin

The Gradle Format plugin enables you to format your Java sources. It operates in place and can be used for instance before pushing changes to enforce a coding style. The formatting can be customized using a properties or XML file with the keys defined in DefaultCodeFormatterConstants from Eclipse. See src/test/resources/ for examples. Eventually you should be able to export Eclipse settings to this file.

The plugin also enables you to sort imports.


To use the Format plugin, include in your build script:

apply plugin: 'com.github.youribonnaffe.gradle.format'

Note that the Java plugin will be applied too.

To run it:

gradle format

The plugin JAR needs to be accessible in the classpath of your build script. It is directly available on Gradle plugins. Alternatively, you can download it from GitHub and deploy it to your local repository. The following code snippet shows an example on how to get it and use it:

plugins {
  id "com.github.youribonnaffe.gradle.format" version "1.5"


The Format plugin defines the following tasks:

  • format: Format Java source code


The Format task defines the following properties:

  • configurationFile: The formatter configuration (File)
  • importsOrder: The import orders (List of strings)
  • importsOrderConfigurationFile: The import orders (a file using Eclipse format)
  • files: The files to format (FileCollection), defaults are Java sources from main and test SourceSets


format {
    configurationFile = file('')
    importsOrder = ["java", "javax", "org", "\\#com.something.StaticImport"]
    files =


Using Hibernate Tools JavaFormatter

Import ordering from EclipseCodeFormatter

Readme format from bmuschko/gradle-gae-plugin

Popular Format Projects
Popular Plugin Projects
Popular Text Processing Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Gradle Plugin