通过运行 gradle build --continuous
应该可以持续构建 Spring Boot 应用程序(即热重载)和 gradle bootRun
按顺序。
我正在尝试修改 gradle 构建文件中的 bootRun 任务,以便它以连续模式调用构建任务,但我似乎无法为其添加参数。
bootRun.dependsOn build
我怎样才能让这个构建持续运行?
最佳答案
This question and the corresponding answers很有趣。
Short answer : 你不能拥有 bootRun
与 continuous
一起运行的任务选项(如果您的应用程序无限期地保持事件状态)
但是有a hack斯蒂芬·克雷恩 :
To get it to live reload you need to have 2 terminals open.
gradle build --continuous
- build --continuous will keep satisfying the initial build request until stopped
gradle build --continuous --quiet & 2>1 >/dev/null
runs in the background, but you would miss the important build warnings/errors.gradle --stop
to stop watching.
gradle bootRun
- bootrun starts with spring-boot-devtools on classpath, which will detect changes and restart application.
我想这就是你要找的。
关于spring-boot - Spring Boot bootRun 持续构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52092504/