Gradle lock异常:另一个Gradle实例正在使用Gradle

时间:2015-09-17 09:42:36

标签: java jenkins gradle continuous-integration continuous-deployment

我有一个Gradle奇怪的问题,似乎与我的代码无关。当我检查Jenkins时,构建被打破了这个例外:

.

任何提示?

感谢。

2 个答案:

答案 0 :(得分:1)

  

如果您的Gradle版本为4.1及更高版本

这是可能的原因。

  1. 在共享网络中,有人从同一个gradle home directory启动了gradle构建。现在,在您的VM /计算机中,您正在尝试从同一个目录运行另一个构建。

    这里会发生什么

    上次运行时已通过gradle锁定了构建和映射缓存文件,现在对于您的构建,您将获得lockException

    您可以做什么

    即使您杀死了计算机上运行的所有gradle进程,也无法删除锁定。     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. 
    
  2. 当先前的构建未正确终止并且锁仍然存在时,也会发生这种情况。

答案 1 :(得分:0)

当您运行新版本时会发生这种情况,但之前的版本已暂停。 要解决此问题,您必须删除 cache.properties.lock 文件