【问题标题】:Grails 4 hot swap / recompileGrails 4 热插拔/重新编译
【发布时间】:2020-04-22 09:17:22
【问题描述】:

我正在使用: 智能 grails版本:4.0.3 gorm.version: 7.0.4.RELEASE

我刚刚得到: Testcontroller.groovy changed, recompiling...

但是我的代码不是热部署的。 使用 Grails 3 一切正常。

如何才能使 Grails 4 和 Spring Boot 2 中的控制器热部署?

【问题讨论】:

    标签: spring spring-boot grails


    【解决方案1】:

    您可以使用 spring-loaded(项目已闲置多年但仍然有效)或 JRebel 进行“热”重载。

    启用:

    build.gradle

    dependencies {
        // Remove dev-tools from classpath
        // developmentOnly("org.springframework.boot:spring-boot-devtools") 
        agent "org.springframework:springloaded:1.2.8.RELEASE"
        // (Optional) Native OSX file watcher
        runtimeOnly "io.methvin:directory-watcher:0.9.6"
        //...
    }
    

    见:https://github.com/grails/grails-core/pull/11441

    【讨论】:

    • 这不适用于 Grails 4.0.11(截至今天的最新版本)。在一个新的空应用程序上进行了测试。 Devtools 可以工作,但 spring-loaded 什么都不做。尝试了弹簧加载的 1.2.8 和 1.3.0,explicitly declares 它应该适用于 Grails 4.0.4+。任何帮助都非常感谢。
    【解决方案2】:

    很好地解决了忘记在 build.gradle 中:

        developmentOnly("org.springframework.boot:spring-boot-devtools")
    

    与旧的 Spring boot 相比,它非常慢,但确实可以工作。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多