Changes to domain files in grails app not detected
Sometimes I get the old errors when compiling and running a grails app - it is as though idea is not detecting that .groovy domain files have been altered and new class files should be placed in my ~/.grails/1.1/projects/myApp/classes directory
if I delete all the class files in that directory the problem is solved
how can I tell intellij to clean this directory each time I run?
intellij idea 8.1 #9732
grails 1.1
Groovy Version: 1.6.0 JVM: 1.6.0_03
solaris 10
请先登录再写评论。
IntelliJ IDEA doesn't manage this directory, so it appears that it's
Grails itself who doesn't detect the changes to domain classes. Another
possible variant is that it detects them, but fails to hot-swap your
domain class and therefore you get old behavior.
normally if I was to deploy a grails app I would type (from the project directory)
This would allow me to change classes and have them immediately recompiled on my website. However I don't feel like typing out a classpath everytime I need to develop something. That is why I use an IDE.
Hitting the IntelliJ run button was less successful - rarely were changes detected. However, all my module dependencies were found.
IntelliJ runs:
I had better luck using the maven-grails plugin, which wraps the gant goals as maven goals.
This appears to allow changes to be detected and my depedencies to be found and also managed by maven.
Are changes detected correctly if you use command line only? We are only
simulating the command line call, we don't perform 'smart' optimizations
for non-modified files.
The command line was equally unresponsive. I suppose I don't understand why IntelliJ is using Java instead of Grails to run the web application.
That's simple. If you look into your grails script and inline
startGrails call inside, you'll get a similar Java command line.
for some reason if I designate
-Dgrails.env=development
so that it is using HSQLDB instead of MySQL then the hotswapping works again in intellij
this makes no sense to me as I didn't think the database backend would affect the class file changes
I guess this really must be a grails issue.