Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable reloading in Grails 3.1 / springloaded

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?)

like image 850
runeaen Avatar asked Feb 05 '16 14:02

runeaen


2 Answers

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

grails {
   agent {
      enabled = false
   }
}

to build.gradle.

like image 70
Burt Beckwith Avatar answered Sep 21 '22 05:09

Burt Beckwith


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!

like image 26
runeaen Avatar answered Sep 22 '22 05:09

runeaen