Spotless plugs into Gradle, Maven, and SBT to format and fix many source and markup languages from your build. It handles encoding, line endings, license headers, and incremental checks.
Overview
Spotless is a formatting layer for software projects that applies consistent style across many languages and file types from within common Java build tools. You configure formatters and steps once; the tool can both report drift and rewrite files so reviews focus on logic rather than spacing debates.
It ships as dedicated integrations for Gradle and Maven, with an external path for SBT and hooks for other build systems. Under the hood it composes small formatting steps—import ordering, trailing whitespace, license headers, and language-specific formatters such as Google Java Format, ktlint, prettier, black, and Eclipse-based formatters for several ecosystems.
Operational features aimed at large repos include idempotent formatting safeguards, encoding checks, optional ratcheting against a git reference so only changed files are enforced, spotless on/off regions in files, and faster incremental format or up-to-date checks. Gradle-oriented flows also mention build cache support for formatting on fresh checkouts.
Editor and IDE workflows are linked from the project overview: Gradle users can tie into VS Code and IntelliJ with either a Spotless daemon or the Gradle integration, so local edits and CI can share the same rules without each developer running ad hoc formatters.
Key features
- Gradle, Maven, and SBT integrations
- Many language and markup formatters
- License header and import-order steps
- Git ratchet and incremental checks
- Encoding and idempotency safeguards
- Prettier, ESLint, and npm-based formatters
- Toggle regions with spotless off/on markers
- VS Code and IntelliJ Gradle integrations
Use cases
- Enforce formatting in CI via Gradle or Maven
- Standardize style across polyglot repositories
- Apply license headers on save or check
- Format only files changed since a git branch
- Compose custom steps with native or regex rules