无法使用 GradleUserHomeServices.createCachingFileHasher() 创建 FileHasher 类型的服务

发布于 2025-01-10 21:01:40 字数 535 浏览 0 评论 0原文

当我尝试同时运行 2 个 gradle 项目时,它会抛出以下错误:

无法使用 GradleUserHomeServices.createCachingFileHasher() 创建 FileHasher 类型的服务。

等待锁定文件哈希缓存超时(/Users/username/.gradle/caches/6.4/fileHashes)。它当前正被另一个 Gradle 实例使用。
所有者 PID:40300
我们的PID:44136
业主操作:
我们的运作:
锁定文件:/Users/epereda/.gradle/caches/6.4/fileHashes/fileHashes.lock

我读过最好的解决方案是使用命令“killall -9 java”或某些衍生命令杀死几乎所有的java进程这会杀死阻止新应用程序启动的进程,是的,当我完成一个应用程序时,我可以启动任何其他应用程序,但问题是我实际上需要运行 3 个在本地相互通信的应用程序机器,但是当我运行第一个机器时,其他两个机器给我这个错误。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼眸里的快感 2025-01-17 21:01:40

例外:

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

删除锁定文件对我有用

rm /Users/epereda/.gradle/caches/6.4/fileHashes/fileHashes.lock

Exception:

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

Removing lock file worked for me

rm /Users/epereda/.gradle/caches/6.4/fileHashes/fileHashes.lock
ゃ人海孤独症 2025-01-17 21:01:40

如果有人发现它有用,我会回答我自己的问题:

解决方案是为每个作业指定不同的 gradle-user-home。具体来说,将其设置为当前工作目录。 (即项目目录),您可以使用以下命令来完成此操作:

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

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)>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文