Cannot lock Java compile cache (xxx)as it has already been locked by this process 解决办法

Posted 格子衫111

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot lock Java compile cache (xxx)as it has already been locked by this process 解决办法相关的知识,希望对你有一定的参考价值。

做单元测试运行的时候,遇到报错,报错信息如下:
Execution failed for task ‘:compileJava’.
'> Could not create service of type DefaultGeneralCompileCaches using GradleScopeCompileServices.createGeneralCompileCaches().
'> Cannot lock Java compile cache (C:\\Devin\\code2\\global-adapter\\source.gradle\\6.9.1\\javaCompile) as it has already been locked by this process.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

首先是因为 build的时候冲突
C:\\Devin\\code2\\global-adapter\\source.gradle\\6.9.1\\executionHistory

解决办法:
方式1:进入该目录, 删除.lock文件

如果方式1还不行,可以试试第2种方式

方式2:终止GradleDaemon进程
win+R打开DOS窗口,输入jps命令查看GradleDaemon对应的进程号,输入“taskkill -PID 进程号 -F”命令终止该进程

如果方式1还不行,可以试试第3种方式

方式3:重启电脑
因为它已经被这个进程锁定,那就是有些进程占用的概念,那试试重启电脑吧

以上是关于Cannot lock Java compile cache (xxx)as it has already been locked by this process 解决办法的主要内容,如果未能解决你的问题,请参考以下文章

Cannot find the system java compiler. Check that your class path includes tools.jar报错处理

java 启动 cannot find symbol

java 启动 cannot find symbol

java 启动 cannot find symbol

java 启动 cannot find symbol

IDEA错误:Cannot start compilation: the output path is not specified for module "XXX".