Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The spotless formatting plugin creates and index of all (java) files, with a fingerprint to decide which files have changed.
Spotless runs and updates the formatting each time the code compiles, so essentially any
mvncommand.The index file is by default stored in the
targetfolder and is therefore wiped each timemvn cleanruns, which is probably on the majority of builds/runs/test runs.Re-indexing on my machine takes around 8s.
This change moves the location of the index file to a hidden folder in the project root. It's excluded from git as it could grow to quite a size and there might be some OS differences.
Now though, indexing will run occasionally (new checkout of project, formatter changes etc.) but after that each local copy will have a persistent index file not cleared by maven, and will save however long it was taking spotless to recreate the index on each build.
Testing notes
Run
mvn clean compile, and the build will paused for a while on spotless while the index is created (will be created regardless of runningcleansince the index is now created in.spotlessrather thantarget.Then, re-run the command, and spotless should re-use the existing index and not pause, speeding up the build.