1

I have a Grails project that includes a separate Gradle project containing utility Java/Groovy classes that are shared among many projects. I am using a multi-project build so that I can develop both projects simultaneously.

The utility classes in the included project are not being hot-swapped / hot-reloaded / auto-reloaded / spring-loaded (I guess there are a lot of synonyms for this concept). This means that every time I make a change in one of the utility classes from the included project, I have to restart the Grails application.

Does anyone know how to make the subproject use the hot-swapping feature that Grails uses? It looks from this comment that Grails does this using Spring Boot's spring-loaded feature: https://github.com/spring-projects/spring-boot/issues/43#issuecomment-24723710

I have even tried setting up the subproject as suggested in this tutorial on using the spring-loaded feature: http://mrhaki.blogspot.com/2015/09/spring-sweets-reload-classes-spring.html. But when I run gradle -t classes, I end up with this output:

Continuous build is an incubating feature.
:compileJava UP-TO-DATE
:compileGroovy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.UnsupportedOperationException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.832 secs

Waiting for changes to input files of tasks... (ctrl-d then enter to exit)

The build fails, but the process is still running. So I tried starting the Grails app and checking if the utility classes were being hot-swapped, but they weren't. I hope there is a solution that doesn't require starting a separate process with gradle -t classes before starting the Grails app, but either way, if anyone has any ideas, I'd love to hear them.

Michael Knopf
  • 121
  • 1
  • 2
  • 4

0 Answers0