Al-Punk
Al-Punk

Reputation: 3660

Enable Grails 3.x auto-reload in IntelliJ

Probably not important, but anyone having problem with the IntelliJ reload option in Grails?

Starting the application from the IntelliJ Run App sets Reloading active: false

I tried through the console (powershwell) to clean and relaunch the app. Reloading is true and set as expected.

Running IntelliJ 14.1.1/Grails 3.0.1/JDK 1.8.025

Upvotes: 8

Views: 4057

Answers (6)

5ar
5ar

Reputation: 84

try starting with -Xverify:none VM argument

Upvotes: 2

Yevdo Abramov
Yevdo Abramov

Reputation: 634

These steps worked for me:

  1. Set the VM options to: -Ddisable.auto.recompile=false -Xverify:none

  2. Add this to the build.gradle ... buildscript { ... dependencies { ... classpath 'org.springframework:springloaded:1.2.0.RELEASE' ... } } ...

Upvotes: 1

Mario
Mario

Reputation: 4988

There is a pretty good blog post about grails3 and itellij untitled Developing Grails 3 Applications With IntelliJ IDEA. It is the number 6 in a Grails QuickCast serie. In the minute number 3:20 you will find a -noverify reference.

Here is the link: https://www.ociweb.com/products/grails/grails-quickcast-6-developing-grails-3-applications-with-intellij-idea/

Upvotes: 0

Igor Mukhin
Igor Mukhin

Reputation: 15368

Auto-reloading isn't working for me in Windows at all.

In Ubuntu everything works out of the box. For IntelliJ I had to add the following VM options in the "Grails:Appname" Run Configuration:

-noverify -javaagent:/<PATH_TO_GRAILS>/grails/3.0.9/lib/org.springframework/springloaded/jars/springloaded-1.2.4.RELEASE.jar

Upvotes: 1

Kersy
Kersy

Reputation: 116

If the Reloading Active is still set to "False" Follow the steps below:

  1. Look on the Right side of the IntelliJ Window.
  2. Click on the Gradle icon.
  3. Click on tasks.
  4. Click on application.
  5. Click on run.

Optional: You can set the -Xverify:none option in the VM Options maybe VM Arguments too.

If that does not help, try upgrading from 1.8.0_25 to _40, _51 or _60.

Good Luck!

Upvotes: 2

JonathanH-UK
JonathanH-UK

Reputation: 53

I battled with this for a while, even attempting some deep-level stepping through in the debugger until I gave up...

It seems that the '-reloading' argument is simply ignored by grails if passed in via running the grail-app/init/.../Application using IntelliJ's run: It auto-recompiles changed files but the running instance never reloads. It's something to do with the springloaded java agent not being set up when it's started using this method.

Anyway - I think there's two important facts in play: Firstly Grails3 is very different to Grail2 and isn't really supported by IntelliJ 14, so you need to import it as a Gradle project. Secondly, you need to use the gradle task called 'run' to start the app (either in 'Run' or 'Debug' mode) using Tasks->Application->Run then the automatic reloading works fine.

Upvotes: 2

Related Questions