I am having a Gradle weird issue which does not seem to be related with me code. When I checked Jenkins, the build was broken with this exception:
Caused by: org.gradle.cache.internal.LockTimeoutException: Timeout waiting to lock buildscript class cache for build file '/Users/me/IdeaProjects/api/explore/build.gradle' (/Users/me/.gradle/caches/2.2/scripts/build_dr53ryug2vbnxp25bu47jmb6a/ProjectScript/buildscript). It is currently in use by another Gradle instance.
Owner PID: unknown
Our PID: 10869
Owner Operation: unknown
Our operation: Initialize cache
Lock file: /Users/me/.gradle/caches/2.2/scripts/build_dr53ryug2vbnxp25bu47jmb6a/ProjectScript/buildscript/cache.properties.lock
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.lock(DefaultFileLockManager.java:258)
at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.<init>(DefaultFileLockManager.java:127)
at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:80)
at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:99)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:46)
... 44 more
Any hint?
Thanks.
If you are having gradle version 4.1 and above
Here are possible reasons.
In a shared network, somebody has initiated a gradle build from your same gradle home directory
. Now in your VM/machine, you are trying to run another build from the same direcory.
what happens here
The build and mapping cache files are locked by gradle by the previous run and now for your build, you are getting the lockException
.
what can you do
Even if you kill all the gradle processes running on your machine, you cannot remove the lock.
a. Go to the machine where you think another build has been triggered to stop the build
b. Clear all the .gradle/.cache and re-run the build.
Can also happen when the previous build not terminated properly and lock still exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With