Grails auto reload functionality in run-app on a custom environment
Asked Answered
C

3

21

When running a custom environment with grails via grails -Dgrails.env=custom run-app it appears that the auto reload / hot deploy is turned off, does anyone know how to arbitrarily enable this for any given environment, not just dev, which appears to be the only env where it is actually on by default?

Coleslaw answered 25/8, 2009 at 2:18 Comment(1)
A little late here, but it appears that auto-recompilation of GSP files is disabled for custom run environments, and for some reason Grails also ignores the disable.auto.recompile flag. I was able to get GSP files to recompile by passing in -Dgrails.gsp.enable.reload=true to the run-app script.Fimble
H
18

I resolved this by adding the following to my env(custom in this case) Config.groovy:

    custom {

    disable.auto.recompile=false
    grails.gsp.enable.reload=true
}

You can also add the -reloading flag to your run config:

grails -reloading -Dgrails.env=custom  run-app

Make sure it is the first arg!

Right-click your project -> Run as -> Run configurations

Run Config changes

Blog post about auto refresh in a Grails custom env

Headwaters answered 19/12, 2012 at 19:55 Comment(4)
Is it for Just GSP files? What about making it auto reload for all kind of files not limited to GSP only?Cyrillic
What types of files are you seeing not reloading @ishwor?Headwaters
You said, make sure it's the first arg, but in the screenshot it's the 2nd arg. Is that a typo?Serow
Yes, the screenshot is outdated, I need to update itHeadwaters
P
3

The flag you want is "disable.auto.recompile", ex:

grails -Dgrails.env=custom -Ddisable.auto.recompile=false run-app
Pritchett answered 25/8, 2009 at 18:24 Comment(3)
This seems to be shaky, for example raw code changes in a controller or service it works for, but say js, css, or html changes within the application views or web-app dir, no dice?Coleslaw
Those don't get auto-loaded for you anyway? Weird, that works fine for me even without the disable.auto.recompile. Do you have something cached? If you're using firefox hit cmd-shift-R (or ctl-shift-R on windows) to reload and bypass the cache.Pritchett
Nope, doesn't seem to happen for me, does in dev mode though... very strange.Coleslaw
J
0

solve the problem with the name change of my folder containing the project ... this time a name that had spaces ... since quite the spaces everything started to work well

Jetta answered 29/11, 2017 at 15:34 Comment(2)
Please spend some more effort writing an answer. Start with complete sentences and punctuation.Schmit
Sorry, what I want to say is that I solve the problem by changing the name of the folder that contains my project. previously the folder had a name that contained spaces, after removing those spaces everything worked well .. Example my folder to myfolderJetta

© 2022 - 2024 — McMap. All rights reserved.