Kill all Gradle Daemons Regardless Version?

后端 未结 3 1762
庸人自扰
庸人自扰 2021-01-03 21:35

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 vers

相关标签:
3条回答
  • 2021-01-03 22:01

    The gradle daemons did not disappear after 3hrs; this could be since I am running as Linux Guest in VirtualBox.

    And hence, the following removes all gradle daemons but it could be "frowned upon" since it might be excessive...

    (1) ./gradlew --stop to ensure all daemons are stopped

    (2) delete all folders/files in .gradle folder in the project

    (3) delete .gradle folder in /home/username/ Linu (4) reboot

    All daemons are gone. The next build takes a bit longer but worthwhile as do not like seeing 6 stopped daemons everytime a gradle build or even clean is started.

    0 讨论(0)
  • 2021-01-03 22:19

    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?

    0 讨论(0)
  • 2021-01-03 22:26

    The gradle --status command will show you the process ids for each of the daemons. You can then use your OS to kill those processes.

    I'm assuming this is cross-platform functionality, but this is the output on Windows:

      PID STATUS   INFO
    10276 IDLE     5.4.1
    14068 IDLE     5.4.1
    

    It's a bit better than playing whack-a-mole with every java.exe process running on your system. Although it would be nice if gradle had a command that could terminate all running gradle daemons built-in.

    0 讨论(0)
提交回复
热议问题