Disable reloading in Grails 3.1 / springloaded

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 01:23:53

问题


I'm trying to disable automatic reload/recompiling in Grails 3.1 as I would like to use JRebel instead. I find springloaded rather limited, but more importantly is constantly fails with

File /Users/engrun/Development/projects/grailsPoc/grails-app/controllers/grailsPoc/HelloController.groovy changed, recompiling...
java.lang.IllegalAccessException: Class org.springsource.loaded.ReloadableType can not access a member of class org.springframework.aop.framework.CglibAopProxy$ClassLoaderAwareUndeclaredThrowableStrategy with modifiers "public"

I have tried all kinds of settings that I have found available, however, none actually disables reloading when running the run-app command

I have tried

disable.auto.recompile=true

on command line, GRAILS_OPTS, and in application.yml

I have tried the

-noreloading

flag, both on command line and GRAILS_OPTS.

According to docs, this should have worked https://grails.org/wiki/Auto%20Reloading

And the answer accepted as the correct one here how can I disable reloading in a grails 3.0.0 app? does not work either.

Have anyone actually succeeded in disabling auto-reloading in Grails 3.1? (And successfully configured Grails 3 with JRebel?)


回答1:


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

grails {
   agent {
      enabled = false
   }
}

to build.gradle.




回答2:


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" }



回答3:


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!



来源:https://stackoverflow.com/questions/35226076/disable-reloading-in-grails-3-1-springloaded

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