Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell intelliJ IDEA to refresh my classes and resources in a grails app?

Set up: I have a grails project in IntelliJ Idea. I run the application by clicking on the "Play" button up top where I have a grails configuration with the default grails run command "run-app". All good there.

Problem: When I make a change to a gsp, controller, css, js or any other file If I click refresh on the browser (Control +F5) the changes are not reflected. I have to stop/restart. This is slowing me down.

What I have done:

  1. I have also tried to set up a Tomcat configuration and run that as a web archive exploded but it is still not working for grails apps. However, it did work for my other Spring/Hibernate web applications.
  2. I have also tried STS IDE and classes and resources get updated fine as I make changes.

Does anybody know how to tell IntelliJ IDEA update classes and resources for a Grails app?

like image 329
Viriato Avatar asked Mar 08 '11 20:03

Viriato


2 Answers

According to the Definitive Guide to Grails book,on page 34 it states that hot reloading is only available when running on dev mode. Thanks Nate (my coworker) for pointing that out.

So the moral of the story is that when you are ready to deploy your model to a real physical database, put the database settings in the "development" section not in the test section. That is if you want hot reloading of course for quick development.

like image 134
Viriato Avatar answered Oct 14 '22 21:10

Viriato


If you run a grails application using grails dev run-app, the application won't be hot reloaded. So, just start your application using grails run-app.

like image 21
Fran García Avatar answered Oct 14 '22 22:10

Fran García