DevOps / Gradle8 Interview Questions
How do you troubleshoot a configuration cache invalidation issue?
When the configuration cache unexpectedly misses (re-runs full configuration when you expected a hit), Gradle's own reporting is the first and most reliable source of the answer rather than guessing.
- Run with
--configuration-cache-problems=warn(or check the automatically generated HTML report after a build) to see exactly which build-script constructs are flagged as incompatible. - Look for common culprits: reading a
Projectproperty or environment variable directly during task configuration instead of through the Provider API, referencing theprojectobject inside a task action closure, or using a plugin that hasn't been updated for configuration-cache compatibility. - Check whether an input actually changed that you didn't expect to — a file path, timestamp-sensitive value, or system property picked up during configuration.
- For third-party plugins, check the plugin's release notes or issue tracker for known configuration-cache incompatibilities before assuming the problem is in your own build script.
The report Gradle generates on a configuration-cache miss lists each specific problem with a file and line reference, which is almost always faster than manually bisecting the build script to find the offending line.
More Related questions...
