Home > Software engineering >  Could not create service of type FileHasher using GradleUserHomeServices.createCachingFileHasher()
Could not create service of type FileHasher using GradleUserHomeServices.createCachingFileHasher()

Time:03-03

When I try to run 2 gradle projects simultaneously, it throws me the following error:

Could not create service of type FileHasher using GradleUserHomeServices.createCachingFileHasher().

Timeout waiting to lock file hash cache(/Users/username/.gradle/caches/6.4/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 40300
Our PID: 44136
Owner Operation:
Our operation:
Lock file: /Users/epereda/.gradle/caches/6.4/fileHashes/fileHashes.lock

I have read that the best solution is to kill practically all the java processes with the command "killall -9 java" or some derivative that kills the process that prevents the new application from starting, and yes, when I finish an application I can start any of the others , but the thing is that I actually need to run 3 applications that communicate with each other on my local machine, but when I run the first one, the other 2 give me that error.

CodePudding user response:

I'll answer my own question in case someone finds it useful:

The solution is to specify a different gradle-user-home for each job. Specifically, setting it to the current working directory. (i.e. project directory) and you can do it whit the following command:

./gradlew -g $PWD <build (or bootRun or etc the command you need)>
  • Related