Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

java - Kill all Gradle Daemons Regardless Version?

Summary

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.

Use case

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.

What I am looking for

  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.

Helpful links to the gradle docs

Disabling the Daemon

Stopping an existing Daemon

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Under linux you may use pkill:

pkill -f '.*GradleDaemon.*'

Under windows you may use wmic:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...