You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Toggle with [`spotless:off` and `spotless:on`](plugin-gradle/#spotlessoff-and-spotlesson)|:+1:|:+1:|:white_large_square:|:white_large_square:|
83
83
|[Ratchet from](https://github.com/diffplug/spotless/tree/main/plugin-gradle#ratchet)`origin/main` or other git ref |:+1:|:+1:|:white_large_square:|:white_large_square:|
84
84
| Define [line endings using git](https://github.com/diffplug/spotless/tree/main/plugin-gradle#line-endings-and-encodings-invisible-stuff)|:+1:|:+1:|:+1:|:white_large_square:|
85
-
| Fast incremental format and up-to-date check |:+1:|:white_large_square:|:white_large_square:|:white_large_square:|
85
+
| Fast incremental format and up-to-date check |:+1:|:+1:|:white_large_square:|:white_large_square:|
86
86
| Fast format on fresh checkout using buildcache |:+1:|:white_large_square:|:white_large_square:|:white_large_square:|
Copy file name to clipboardExpand all lines: plugin-maven/README.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -923,6 +923,47 @@ If your project has not been rigorous with copyright headers, and you'd like to
923
923
924
924
<aname="ratchet"></a>
925
925
926
+
## Incremental up-to-date checking and formatting
927
+
928
+
**This feature is turned off by default.**
929
+
930
+
Execution of `spotless:check` and `spotless:apply` for large projects can take time.
931
+
By default, Spotless Maven plugin needs to read and format each source file.
932
+
Repeated executions of `spotless:check` or `spotless:apply` are completely independent.
933
+
934
+
If your project has many source files managed by Spotless and formatting takes a long time, you can
935
+
enable incremental up-to-date checking with the following configuration:
936
+
937
+
```xml
938
+
<configuration>
939
+
<upToDateChecking>
940
+
<enabled>true</enabled>
941
+
</upToDateChecking>
942
+
<!-- ... define formats ... -->
943
+
</configuration>
944
+
```
945
+
946
+
With up-to-date checking enabled, Spotless creates an index file in the `target` directory.
947
+
The index file contains source file paths and corresponding last modified timestamps.
948
+
It allows Spotless to skip already formatted files that have not changed.
949
+
950
+
**Note:** the index file is located in the `target` directory. Executing `mvn clean` will delete
951
+
the index file, and Spotless will need to check/format all the source files.
952
+
953
+
Spotless will remove the index file when up-to-date checking is explicitly turned off with the
954
+
following configuration:
955
+
956
+
```xml
957
+
<configuration>
958
+
<upToDateChecking>
959
+
<enabled>false</enabled>
960
+
</upToDateChecking>
961
+
<!-- ... define formats ... -->
962
+
</configuration>
963
+
```
964
+
965
+
Consider using this configuration if you experience issues with up-to-date checking.
966
+
926
967
## How can I enforce formatting gradually? (aka "ratchet")
927
968
928
969
If your project is not currently enforcing formatting, then it can be a noisy transition. Having a giant commit where every single file gets changed makes the history harder to read. To address this, you can use the `ratchet` feature:
0 commit comments