Lock on shared .gradle


We are trying to use one single .gradle cache among our multiple build workers (in jenkins) by creating .gradle in NFS mount which is shared with all the workers. We have also set the following in gradle properties under .gradle to use parallel builds

Now when we run multiple projects using gradle builds, they get failed with following errors,

Timeout waiting to lock artifact cache (/common/user/.gradle/caches/modules-2). It is currently in use by another Gradle instance.
Owner PID: 1XXXX
Owner Operation: resolve configuration ':classpath’
Our operation: resolve configuration ':classpath’
Lock file: /common/user/.gradle/caches/modules-2/modules-2.lock

What is the suggestive method to use .gradle cache sharing among multiple users. This model works fine for maven .m2 cache.

We cannot have .gradle for each workers as it occupies lot of space to store the jars in cache. Please suggest

1 Like