Skip to content

Conversation

@rs-fraser
Copy link
Contributor

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 mvn command.

The index file is by default stored in the target folder and is therefore wiped each time mvn clean runs, 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 running clean since the index is now created in .spotless rather than target.

Then, re-run the command, and spotless should re-use the existing index and not pause, speeding up the build.

…index would be wiped each 'mvn clean'. ignored by git so indexing will run once per local folder, then any subsequent runs of spotless (tied to compile goal so runs a lot) will be much quicker. takes 'mvn clean compile' from 20s to 13s on my machine, after the first run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant