I recently upgrade our project to grails 2.3.0. Everything works fine except I've been having problems with auto-reload not working whenever I make changes to our code. This include all projects artefacts - controllers, domain, services, gsps, css and javascript files.

My older versions of grails work correctly and reloads and recompile every time I make a change.

I know this question is popular and I have searched Jira, Nabble and here for days now but none of what I have found have been able to solve my problem (I've even tried to add quotes like Peter suggested in this thread http://jira.grails.org/browse/GRAILS-7936 and also this thread Grails Project Not Auto Reloading did not help).

Am currently running grails on a Macbook pro with the following settings:

  • grails version 2.3.0
  • Java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
  • Running from terminal with Textmate as IDE

Any help would be greatly appreciated.

有帮助吗?

解决方案

It seems that in Grails 2.3 the reloading is no longer the default

In Grails 2.3 the reloading agent is no longer on the build system path unless you pass the -reloading flag to the grails command:

grails -reloading run-app

However, you can enable forking in your buildConfig using the following configuration:

forkConfig = [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 256] 
grails.project.fork = [    
  test: forkConfig, // configure settings for the test-app JVM    
  run: forkConfig, // configure settings for the run-app JVM    
  war: forkConfig, // configure settings for the run-war JVM    
  console: forkConfig // configure settings for the Swing console JVM ]

More information : Forked Execution and the Reloading Agent

其他提示

I am using Grails 2.4.3 and IntelliJ 13 and I found that I had to have the -reloading part at the end of the run-app command.

In other words when you edit your Run/Debug configurations, in the 'Command Line' part put run-app -reloading and NOT -reloading run-app.

I found this solution here from user longwa

Grails 2.4.x maintained the same support:

grails -reloading run-app

The logs will show the status of the reload once a "watched" file changes in the file-system:

2014-09-23 00:42:02,666 [localhost-startStop-1] INFO  conf.BootStrap  - Checking for registries in system env
| Server running. Browse to http://localhost:8080/docker-registry-ui
| Compiling 1 source files.....

I was not able to fix my problem with reloading by any of the suggestions above. In my case the problem was my path, it contained a space! Took me a couple of days and half my beard but finally figured it out. My path was something like : ~/Box Sync/path/to/project. That single space in Box Sync was the hidden bad guy. I beleive it to be related to this ticket https://github.com/grails/grails-core/issues/9344.

I dont need run with -reloading in the command line, its problem of springloaded.jar.

replace folder springloaded in grailsHome/lib/org.springframework/springloaded with the of grails sdk 2.4.3

https://mega.co.nz/#F!INgVnboD!r7ssrFy9TiCQ50ROqxWt8g

I tested in grails 2.5.0 and 2.4.*

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top