6

I'm new to grails and came across an issue of grails shell not recompiling my classes even though displaying a message about it. Here is what I'm doing:

  1. I have a grails 2.0.0 app that has class with certain static methods
  2. I would like to test some of the functionality from grails shell, so I go ahead and launch it from the grails project folder as grails shell
  3. I'm calling a static method of the class to perform some work as follows:

    import com.mypackage.*
    MyClass.doWork()
    
  4. If I'm seeing some unexpected behavior or runtime error I'm modifying the source code accordingly and grails shell shows it actually is seeing the change: |Compiling 2 source files.

  5. Then I run the method, but it's seems that the method is the same, because it gives me same error even though I'm sure I've saved the groovy file.
  6. So, I have to exit the shell and launch it again. Then grails picks up the changes.

What I'm doing wrong? It seems to be rather weird expected behavior...

Michael Easter
  • 23,733
  • 7
  • 76
  • 107
Tomato
  • 772
  • 8
  • 17

1 Answers1

11

Only run-app enables reloading by default. Run grails -reloading shell to reload changed files. I'd use the console though - it's way more user-friendly: grails -reloading console.

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156