You install maven-build-cache-extension , your unchanged modules start restoring from cache in seconds, and PR builds feel fast. Then you edit one line in a utility class inside your biggest module and the build runs every test in that module again.
That is not a bug in the cache. It is a granularity mismatch, and it is worth understanding precisely, because the two tools solve different halves of the problem and work well together.
What the build cache does
The extension fingerprints a module's inputs (sources, dependencies, plugin configuration) into a checksum. If it has seen that checksum before, it restores the module's outputs and skips the build. If it has not, it runs the module's whole lifecycle, Surefire included.
So the cache's smallest unit is the module . Anything inside it that changes, even a single character in one class, produces a new checksum for the module. There is no "mostly the same" in a checksum.
For a repository with many small modules that is a great trade.…