Spring Boot bootRun 持续构建
Posted
技术标签:
【中文标题】Spring Boot bootRun 持续构建【英文标题】:Spring Boot bootRun with continuous build 【发布时间】:2019-02-05 03:09:38 【问题描述】:应该可以通过依次运行gradle build --continuous
和gradle bootRun
来连续构建(即热重载)Spring Boot 应用程序。
我正在尝试修改 gradle 构建文件中的 bootRun 任务,以便它以连续模式调用构建任务,但我似乎无法为其添加参数。
bootRun.dependsOn build
如何让构建持续运行?
【问题讨论】:
【参考方案1】:This question and the corresponding answers 很有趣。
Short answer :您不能使用 continuous
选项运行 bootRun
任务(如果您的应用程序无限期地保持活动状态)
但是有 Stefan Crain 的a hack:
要让它实时重新加载,您需要打开 2 个终端。
build --continuous 将继续满足初始构建请求,直到停止
gradle build --continuous
gradle build --continuous --quiet & 2>1 >/dev/null
在后台运行,但您会错过重要的构建警告/错误。gradle --stop
停止观看。bootrun 以类路径上的 spring-boot-devtools 开始,它将检测更改并重新启动应用程序。
gradle bootRun
我想这就是你要找的。p>
【讨论】:
谢谢,我知道这是可能的,但想知道它是否可以包含在单个任务中。暂时必须这样做。 仅供参考gradle build --continuous -xtest
跳过 test
任务,我认为这是这个答案的期望。以上是关于Spring Boot bootRun 持续构建的主要内容,如果未能解决你的问题,请参考以下文章
Spring boot 运行错误 bootRun 工作正常,但应用程序运行不工作
使用 Spring Boot“bootRun”启动的应用程序在包含 Gradle Vaadin 插件时会导致 NoClassDefFoundError
Gradle > 如何停止使用 gradle bootRun 启动的 Spring Boot 应用程序?
Spring-boot 和 Gradle:构建时间太长 - 如何调试?
尝试使用 gradle bootrun 编译并获取找不到 spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT