Grails 4 热插拔/重新编译
Grails 4 hot swap / recompile
我正在使用:
Intellij
grails版本:4.0.3
gorm.version: 7.0.4.RELEASE
我刚刚得到:
Testcontroller.groovy changed, recompiling...
但是我的代码不是热部署的。
使用 Grails 3 一切正常。
我该怎么做才能热部署 Grails 4 和 Spring Boot 2 中的控制器?
很好解决忘记在build.gradle:
developmentOnly("org.springframework.boot:spring-boot-devtools")
与旧的 Spring 引导相比,它非常慢,但确实可以正常工作。
您可以使用 spring-loaded(项目已闲置多年但仍然有效)或 JRebel 用于 "hot" 重新加载。
启用:
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"
//...
}
我们为 grails 4.0.13 找到了类似于 @erichelgeson
的解决方案
您在这里找到了它:https://github.com/grails/grails-core/issues/11649#issuecomment-1085910706
bootRun {
jvmArgs(
// javaagent: see
// - https://github.com/grails/grails-core/issues/11649
// - https://github.com/spring-projects/spring-loaded
// - find the jar here: https://repo.spring.io/ui/repos/tree/General/libs-snapshot-local/org/springframework/springloaded
"-javaagent:libs/springloaded-1.3.0.BUILD-20210404.024037-2.jar",
// ...
}
这里是评论区的链接:
我正在使用: Intellij grails版本:4.0.3 gorm.version: 7.0.4.RELEASE
我刚刚得到:
Testcontroller.groovy changed, recompiling...
但是我的代码不是热部署的。 使用 Grails 3 一切正常。
我该怎么做才能热部署 Grails 4 和 Spring Boot 2 中的控制器?
很好解决忘记在build.gradle:
developmentOnly("org.springframework.boot:spring-boot-devtools")
与旧的 Spring 引导相比,它非常慢,但确实可以正常工作。
您可以使用 spring-loaded(项目已闲置多年但仍然有效)或 JRebel 用于 "hot" 重新加载。
启用:
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"
//...
}
我们为 grails 4.0.13 找到了类似于 @erichelgeson
的解决方案您在这里找到了它:https://github.com/grails/grails-core/issues/11649#issuecomment-1085910706
bootRun {
jvmArgs(
// javaagent: see
// - https://github.com/grails/grails-core/issues/11649
// - https://github.com/spring-projects/spring-loaded
// - find the jar here: https://repo.spring.io/ui/repos/tree/General/libs-snapshot-local/org/springframework/springloaded
"-javaagent:libs/springloaded-1.3.0.BUILD-20210404.024037-2.jar",
// ...
}
这里是评论区的链接: