【问题标题】:Spring Boot bootRun with continuous buildSpring Boot bootRun 持续构建
【发布时间】:2019-02-05 03:09:38
【问题描述】:

应该可以通过依次运行gradle build --continuousgradle bootRun 来连续构建(即热重载)Spring Boot 应用程序。

我正在尝试修改 gradle 构建文件中的 bootRun 任务,以便它以连续模式调用构建任务,但我似乎无法为其添加参数。

bootRun.dependsOn build

如何让构建持续运行?

【问题讨论】:

    标签: spring-boot gradle


    【解决方案1】:

    This question and the corresponding answers 很有趣。

    Short answer :您不能使用 continuous 选项运行 bootRun 任务(如果您的应用程序无限期地保持活动状态)

    但是有 Stefan Crain 的a hack

    要让它实时重新加载,您需要打开 2 个终端。

    1. gradle build --continuous

      • build --continuous 将继续满足初始构建请求,直到停止
      • gradle build --continuous --quiet & 2>1 >/dev/null 在后台运行,但您会错过重要的构建警告/错误。 gradle --stop 停止观看。
    2. gradle bootRun

      • bootrun 以类路径上的 spring-boot-devtools 开始,它将检测更改并重新启动应用程序。

    我想这就是你要找的。​​p>

    【讨论】:

    • 谢谢,我知道这是可能的,但想知道它是否可以包含在单个任务中。暂时必须这样做。
    • 仅供参考 gradle build --continuous -xtest 跳过 test 任务,我认为这是这个答案的期望。
    猜你喜欢
    • 2020-05-16
    • 2014-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-19
    • 2017-04-17
    • 2022-07-05
    相关资源
    最近更新 更多