Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
### Changes
- `SpotlessApply` now only reports that it did work (and is otherwise `UP-TO-DATE`) when it actually rewrote a file. ([#2715](https://github.com/diffplug/spotless/issues/2715))
### Fixed
- The README section "Can I apply Spotless to specific files?" no longer documents `-PspotlessFiles`, which the Gradle plugin does not read; it points to `-PspotlessIdeHook` and `ratchetFrom` instead. ([#3183](https://github.com/diffplug/spotless/issues/3183))
- GrEclipse no longer leaves a `file%3A...` directory in the working directory. ([#2019](https://github.com/diffplug/spotless/issues/2019))
- DBeaver SQL formatter no longer prints an `IndexOutOfBoundsException` when a file starts with a keyword like `SET`. ([#1552](https://github.com/diffplug/spotless/issues/1552))
- `expandWildcardImports()` no longer fails with `Symbol resolution not configured` on records and other syntax newer than Java 11, and leaves files JavaParser cannot validate unchanged. ([#2946](https://github.com/diffplug/spotless/issues/2946))
Expand Down
6 changes: 3 additions & 3 deletions plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2165,13 +2165,13 @@ tasks.withType(com.diffplug.gradle.spotless.SpotlessApply).configureEach {

## Can I apply Spotless to specific files?

You can target specific files by setting the `spotlessFiles` project property to a comma-separated list of file patterns:
The Gradle plugin does not read a `spotlessFiles` property like the Maven plugin does (`-PspotlessFiles` was deprecated in `4.3.0` and removed in `5.0.0`). To format one or a few files, pass their absolute paths to the [IDE hook](IDE_HOOK.md) as a comma-separated list:

```
cmd> gradle spotlessApply -PspotlessFiles=my/file/pattern.java,more/generic/.*-pattern.java
cmd> gradle spotlessApply -PspotlessIdeHook=/abs/path/to/A.java,/abs/path/to/B.java
```

The patterns are matched using `String#matches(String)` against the absolute file path.
In this mode `spotlessCheck` is disabled, and `spotlessApply` formats only the listed files that are part of a target. To limit formatting to the files changed on a branch, use [`ratchetFrom`](#ratchet).

<a name="central-configuration"></a>

Expand Down