杀死所有Gradle守护程序,无论版本如何? [英] Kill all Gradle Daemons Regardless Version?

查看:182
本文介绍了杀死所有Gradle守护程序,无论版本如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摘要

我想知道如何杀死机器上运行的每个gradle守护程序和进程,而不管gradle的版本或守护程序的版本如何,但是"--kill"或"--stop"命令只会停止那些与相同版本的gradle匹配的进程.

I would like to know how to kill every single gradle daemon and process running on a machine regardless of the version of gradle or the version of the daemon, but the "--kill" or "--stop" command will only stop those processes that match the same version of gradle.

用例

我的CI构建框将有几个运行不同版本的gradle守护程序(因为我是一个使用包装程序执行构建的好孩子).有时,我会发现缓存或增量生成的问题,作为预防措施,我喜欢杀死守护程序.尽管我使用的任何VCS或IDE发生冲突的可能性更大,但对于我的开发箱来说也是如此.

My CI build box will have several gradle daemons running with different versions (because I'm a good boy that uses the wrapper to execute builds). Occasionally I will find issues with caching or incremental builds, and as a precaution I like to kill the daemons. The same is true for my development boxes, although the conflicts are more often with whichever VCS or IDE I am using.

我在寻找什么

  1. 我希望我能缺少一个标志或属性,我可以 通过简单的一行命令传递给gradle来执行此操作,但是如果它是 足够简单,我可以接受更多.
  2. 没有脚本(循环, if-else等).
  3. 杀死所有Java进程是可以接受的.
  1. I'm hoping there is a flag or property I am missing that I could pass to gradle to do this in a simple one line command, but if it's simple enough I would be ok with more.
  2. No scripting (looping, if-else etc).
  3. Killing all java processes is not acceptable.

指向gradle文档的有用链接

禁用守护程序

停止现有守护程序

推荐答案

在Linux下,您可以使用pkill:

Under linux you may use pkill:

pkill -f '.*GradleDaemon.*'

在Windows下,您可以使用wmic:

Under windows you may use wmic:

WMIC PROCESS where "Name like 'java%' AND CommandLine like '%GradleDaemon%'" Call Terminate

PS.为什么可能最简单的解决方案是不编写脚本"?

PS. Why "no scripting" when it is probably the easiest solution?

这篇关于杀死所有Gradle守护程序,无论版本如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆