Grails 3 not automatically hot swapping changed code after upgrading to 2016.1.3

Answered

I'm using the latest IntelliJ IDEA ultimate edition for a Grails 3 project. Prior to updating to 2016.1.3 I could run my app in debug mode using the gradle bootRun task.  I could update code and not have to stop and restart debug mode.  I'm pretty sure this started happening around the 2016.1.3 update.  I've checked all the hot swap and automatic build settings.

Furthermore, after updating to 2016.1.3 I had to change the IDE boot JDK to my system installed Java 8 from the bundled OpenJDK due to this error when running my Gradle build:

The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.

I never had to set any of this previously and it always worked. Any ideas?

12 comments
Comment actions Permalink

Could you please share your Gradle settings ('Settings->Build, Execution, Deployment -> Gradle' window)? 

0
Comment actions Permalink

Does Gradle refresh help ?

0
Comment actions Permalink

I don't have a refresh task but I've done various combinations of clean and build without any change.  I noticed that if I change some code and do build -> make project I get this error:

 



0
Comment actions Permalink

I removed all the temporary build directories: build, .gradle, and out - then refreshed the Gradle project but I still have the same problem.

0
Comment actions Permalink

Okay...

What Grails Version do you use? Do you have any special VM options configured?  

0
Comment actions Permalink

Thanks for your help troubleshooting this.

I'm using Grails 3.1.4 with Java 1.8.0_92 from Oracle.  The only VM option in my Gradle debug launcher is to set the grails.env to local: -Dgrails.env=local

I just removed this and started using the default development environment config and get a slightly different error when modifying a controller:

File /Users/spencermcewen/Documents/projects/faads_grails/grails-app/controllers/blah blah.groovy changed, recompiling...
Spring Loaded: Cannot reload new version of blah blah
Reason: Interfaces changed from [grails/artefact/Controller, grails/artefact/AsyncController, grails/artefact/gsp/TagLibraryInvoker, grails/artefact/controller/RestResponder, grails/plugins/rendering/RenderingTrait, grails/plugin/springsecurity/ControllerMixin, grails/plugins/rendering/RenderingTrait$Trait$FieldHelper, grails/web/api/ServletAttributes$Trait$FieldHelper, grails/web/api/WebAttributes$Trait$FieldHelper, grails/artefact/controller/RestResponder$Trait$FieldHelper, grails/artefact/gsp/TagLibraryInvoker$Trait$FieldHelper, grails/events/Events$Trait$FieldHelper, grails/artefact/Controller$Trait$FieldHelper, grails/artefact/controller/support/RequestForwarder$Trait$FieldHelper, grails/artefact/controller/support/ResponseRedirector$Trait$FieldHelper, grails/artefact/controller/support/ResponseRenderer$Trait$FieldHelper, grails/transaction/TransactionManagerAware] to [grails/artefact/Controller, grails/artefact/AsyncController, grails/artefact/gsp/TagLibraryInvoker, grails/artefact/controller/RestResponder, grails/plugins/rendering/RenderingTrait, grails/plugin/springsecurity/ControllerMixin, grails/plugins/rendering/RenderingTrait$Trait$FieldHelper, grails/web/api/ServletAttributes$Trait$FieldHelper, grails/web/api/WebAttributes$Trait$FieldHelper, grails/artefact/controller/RestResponder$Trait$FieldHelper, grails/artefact/gsp/TagLibraryInvoker$Trait$FieldHelper, grails/events/Events$Trait$FieldHelper, grails/artefact/Controller$Trait$FieldHelper, grails/artefact/controller/support/RequestForwarder$Trait$FieldHelper, grails/artefact/controller/support/ResponseRedirector$Trait$FieldHelper, grails/artefact/controller/support/ResponseRenderer$Trait$FieldHelper]

However, it looks like GSP and Service classes are being swapped correctly, so that's good. Is there something special happening when the environment is set to development?  I'm pretty sure reloading controllers worked for me previously.

0
Comment actions Permalink

I cannot find any info about reloading in other environments, but it seems to work only in development environment. 

Regarding error: this https://github.com/spring-projects/spring-loaded states that hierarchy change is not supported, which happens when you remove interface from controller.

0
Comment actions Permalink

Thanks - I think this is working good enough for now. I can work around the environment name issue

0
Comment actions Permalink

Spencer : I am facing the same issue. How did you get it to work?

0
Comment actions Permalink

Desair4, try switching your configuration to the "development" environment. I also could only make hot swapping work on the development environment although it worked on any other environments in Grails 2.x.

0

Please sign in to leave a comment.