Disable reloading in Grails 3.1 / springloaded

China☆狼群 提交于 2019-12-01 04:17:52

In 3.x apps you can disable Spring Loaded by adding

grails {
   agent {
      enabled = false
   }
}

to build.gradle.

To enable JRebel for Grails 3 project you need to configure -javaagent argument with the corresponding path the jrebel.jar in build.gradle file:

tasks.withType(JavaExec) { jvmArgs "-javaagent:jrebel.jar" }

Burt's answer is correct related to the question -> how to disable autoreloading.

However, Anton's answer is relevant to the second/related issue on getting Jrebel to work.

I now have a working example, which works with both

gradle bootRun -Pjrebel   -> disable springloaded, using jrebel
gradle bootRun            -> uses springloaded

and

grails
grails> run-app

My config is a combination of

export GRAILS_OPTS="-javaagent:$JREBEL_HOME/jrebel.jar -Drebel.base=/Users/<username>/.jrebel"

and build.gradle

rebel {
  alwaysGenerate = false
  showGenerated = true
//rebelXmlDirectory = "build/classes"
}

if (project.hasProperty('jrebel')) {
  bootRun.dependsOn(generateRebel)
  grails {
    agent {
      enabled = false
    }
  } 
  tasks.withType(JavaExec) {
    jvmArgs "-javaagent:jrebel.jar"
    jvmArgs "-Xverify:none"
  }
}

Thanks @burt-beckwith and @anton-arhipov for your input!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!