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:|
82
82
|[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:|
83
83
| 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:|
84
-
| Fast incremental format and up-to-date check |:+1:|:white_large_square:|:white_large_square:|:white_large_square:|
84
+
| Fast incremental format and up-to-date check |:+1:|:+1:|:white_large_square:|:white_large_square:|
85
85
| 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
Original file line number
Diff line number
Diff line change
@@ -900,6 +900,47 @@ If your project has not been rigorous with copyright headers, and you'd like to
900
900
901
901
<aname="ratchet"></a>
902
902
903
+
## Incremental up-to-date checking and formatting
904
+
905
+
**This feature is turned off by default.**
906
+
907
+
Execution of `spotless:check` and `spotless:apply` for large projects can take time.
908
+
By default, Spotless Maven plugin needs to read and format each source file.
909
+
Repeated executions of `spotless:check` or `spotless:apply` are completely independent.
910
+
911
+
If your project has many source files managed by Spotless and formatting takes a long time, you can
912
+
enable incremental up-to-date checking with the following configuration:
913
+
914
+
```xml
915
+
<configuration>
916
+
<upToDateChecking>
917
+
<enabled>true</enabled>
918
+
</upToDateChecking>
919
+
<!-- ... define formats ... -->
920
+
</configuration>
921
+
```
922
+
923
+
With up-to-date checking enabled, Spotless creates an index file in the `target` directory.
924
+
The index file contains source file paths and corresponding last modified timestamps.
925
+
It allows Spotless to skip already formatted files that have not changed.
926
+
927
+
**Note:** the index file is located in the `target` directory. Executing `mvn clean` will delete
928
+
the index file, and Spotless will need to check/format all the source files.
929
+
930
+
Spotless will remove the index file when up-to-date checking is explicitly turned off with the
931
+
following configuration:
932
+
933
+
```xml
934
+
<configuration>
935
+
<upToDateChecking>
936
+
<enabled>false</enabled>
937
+
</upToDateChecking>
938
+
<!-- ... define formats ... -->
939
+
</configuration>
940
+
```
941
+
942
+
Consider using this configuration if you experience issues with up-to-date checking.
943
+
903
944
## How can I enforce formatting gradually? (aka "ratchet")
904
945
905
946
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