Locking non-empty configurations

The current default behavior of dependency locking is to lock all configurations, including configurations that are empty. In many cases these configurations are empty because they were added by plugins, but are currently not being used by the build. This results in dozens of empty lock files that create noise in the repository. It also appears that Gradle treats the presence of an empty lock file for a configuration differently from the absence of a lock file; specifically, the latter is treated as if the configuration has never been locked, and therefore will not fail the build.

My preferred behavior would be that empty configurations don’t have lock files written at all, and that a missing lock file be treated the same as an empty one. Is there a way to configure Gradle to achieve this behavior?

1 Like