CTRL + C w / Spring Boot& Gradle Kills Gradle Daemon [英] CTRL+C w/ Spring Boot & Gradle Kills Gradle Daemon

查看:77
本文介绍了CTRL + C w / Spring Boot& Gradle Kills Gradle Daemon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Spring Boot Gradle插件启动Tomcat服务器&我的应用。我通过 gradle bootRun 启动Tomcat服务器。我也启用了Gradle守护进程,希望让Gradle构建更快。

I use the Spring Boot Gradle plugin to start a Tomcat server & my app. I start the Tomcat server via gradle bootRun. I've also enabled the Gradle daemon, in hopes to make Gradle builds go faster.

然而,启用守护进程是徒劳的。每次我通过 Ctrl + C 停止服务器,然后使用 gradle bootRun 再次启动服务器,我遇到了消息:

However, enabling the daemon is for naught. Every time I stop the server via Ctrl + C, then start the server again with gradle bootRun, I encounter the message:

Starting a new Gradle Daemon for this build (subsequent builds will be faster).

Ctrl + C 不仅会停止Tomcat服务器在Spring Boot的掩护下,也杀死了Gradle守护进程。这违背了Gradle的守护进程模式的目的。

Ctrl + C not only stops the Tomcat server under the covers of Spring Boot, but also kills the Gradle daemon. Which defeats the purpose of Gradle's daemon mode.

是否有更好的方法我应该停止服务器,希望通过命令行界面在我启动tomcat的同一个终端使用 gradle bootRun ,这使Gradle守护程序保持活动状态?

Is there a better way I should be stopping the server, hopefully via command line interface in the same terminal for which I started tomcat with gradle bootRun, that keeps the Gradle daemon alive?

推荐答案

这个在Gradle 4中仍然存在问题。我最好的妥协/解决方案(建立charlie_pl的答案):

This is still an issue in Gradle 4. My best compromise/solution (building off charlie_pl's answer):


  1. ctrl + z 将正在运行的进程发送到后台。

  2. 杀死进程,如: kill $(ps aux | grepMyApp | grep -v grep | awk'{print $ 2}')

  3. 重启: ./ gradlew run ...

  1. Press ctrl+z to send the running process to the background.
  2. Kill the process like: kill $(ps aux | grep "MyApp" | grep -v grep | awk '{print $2}')
  3. Restart: ./gradlew run ...

这篇关于CTRL + C w / Spring Boot& Gradle Kills Gradle Daemon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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