spotless
Spotless is a build-system-agnostic code formatter that enforces consistent formatting across multiple languages (Java, Kotlin, JavaScript, SQL, etc.). It integrates with Gradle, Maven, and SBT, offering both format checking and automatic fixing with support for incremental builds and git-based ratcheting.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | diffplug/spotless |
| Owner | diffplug |
| Primary language | Java |
| License | Apache-2.0 — OSI-approved |
| Stars | 5.5k |
| Forks | 541 |
| Open issues | 261 |
| Latest release | maven/3.8.0 (2026-06-29) |
| Last updated | 2026-06-29 |
| Source | https://github.com/diffplug/spotless |
What spotless is
Spotless provides a composable formatter framework that abstracts individual language formatters (GoogleJavaFormat, Prettier, KtLint, etc.) behind a common `Function<String, String>` interface. It handles line-ending normalization, encoding validation, idempotency safeguards, and incremental build caching, with native plugins for Gradle and Maven and community support for SBT.
Get the spotless source
Clone the repository and explore it locally.
git clone https://github.com/diffplug/spotless.gitcd spotless# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Choose build-system plugin: native Gradle/Maven recommended; SBT is external (github.com/moznion/sbt-spotless).
- Select formatters per language; each formatter (GoogleJavaFormat, Prettier, KtLint, etc.) has individual configuration and dependencies.
- Configure encoding, line endings, and idempotency safeguards; defaults exist but review for special characters or cross-platform requirements.
- Use `spotless:off` / `spotless:on` markers (Gradle/Maven only) for selective exclusions; unavailable in SBT.
- Enable git ratcheting (Gradle/Maven only) to enforce formatting only on changed files, reducing CI time.
When to avoid it — and what to weigh
- Custom formatter not in supported list — If your language or formatter is not in Spotless' feature matrix (e.g., ClangFormat only for Gradle, no SBT support for most formatters), you may need fallback tooling.
- Minimal formatting overhead is critical — Spotless adds build task overhead; if you need only inline editor formatting without CI checks, consider editor plugins (VS Code, IntelliJ) instead.
- SBT-only projects with advanced features needed — SBT support is external and community-maintained, with gaps in features like ratcheting, git-driven line-ending config, and encoding safeguards compared to Gradle/Maven.
- Pre-existing complex custom formatting pipelines — Migrating existing bespoke formatter configs may require significant rework; evaluate compatibility before adoption.
License & commercial use
Licensed under Apache License 2.0 (Apache-2.0), a permissive OSI-approved open-source license.
Apache-2.0 permits commercial use, modification, and distribution with minimal restrictions (attribution, license notice, liability disclaimer). No commercial restrictions noted in license terms; use for proprietary projects is permitted.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Spotless itself does not validate or sanitize code logic; it performs syntax-safe formatting only. When using external formatters (Prettier, KtLint, etc.), ensure their dependencies are from trusted sources and kept updated. No built-in vulnerability scanning; rely on dependency management (gradle/maven) and third-party tools (e.g., Dependabot).
Alternatives to consider
Prettier (JavaScript/TypeScript/JSON only)
Opinionated, zero-config formatter for web languages; requires manual integration for other languages and build systems.
EditorConfig + language-specific linters (ESLint, Pylint, etc.)
Lightweight, editor-native approach; lacks centralized build integration and automatic fixing across multiple languages.
Google Java Format + manual per-language setup
Single-language formatters; requires custom scripting to compose and integrate; higher overhead than Spotless.
Build on spotless with DEV.co software developers
Integrate Spotless into your Gradle or Maven build to automate formatting checks and fixes. Reduce code-review friction, enforce organizational standards, and support 15+ languages with composable formatters.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
spotless FAQ
Can I use Spotless with only Maven or only Gradle?
Does Spotless support my language or formatter?
What is git ratcheting and should I use it?
Does Spotless slow down my build?
Custom software development services
Need help beyond evaluating spotless? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.
Standardize code formatting across your team
Integrate Spotless into your Gradle or Maven build to automate formatting checks and fixes. Reduce code-review friction, enforce organizational standards, and support 15+ languages with composable formatters.