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
Helpful links to the gradle docs
Disabling the Daemon
Stopping an existing Daemon
If you wish to stop a Daemon process manually, you can either kill the process via your operating system task manager or run the gradle --stop command. The --stop switch causes Gradle to request that all running Daemon processes, of the same Gradle version used to run the command, terminate themselves.
IntelliJ interacts with Gradle via the Gradle tooling API, which always uses the daemon. i.e. There is no way to turn it off. "gradle idea" is needed only to generate the required files. Though the recent versions of Idea use "directory-based" project structure, so the file generation is no longer necessary.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With