Grails shell doesn't recompile changed files
Asked Answered
T

1

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...

Tridimensional answered 5/3, 2012 at 21:1 Comment(0)
M
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.

Mitran answered 5/3, 2012 at 22:3 Comment(1)
Thanks a lot, I didn't think about it this way.Tridimensional

© 2022 - 2024 — McMap. All rights reserved.