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

Comment actions Permalink

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.

Comment actions Permalink

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:

java \
-Dgrails.env=test \ \
-Dserver.port=9585 \
-Denable.jndi=false \ \
-Drecompile.frequency=2 \
-Xmx256M \
-Dgrails.home=/opt/localhome/grails \
-Dbase.dir=/home/leipzig/Documents/renewalWeb \
-Dtools.jar=/usr/jdk/jdk/lib/tools.jar \
-Dgroovy.starter.conf=/opt/localhome/grails/conf/groovy-starter.conf \
-Dfile.encoding=US-ASCII \
-classpath /opt/localhome/grails/lib/groovy-all-1.6.0.jar:...lots of jars

I had better luck using the maven-grails plugin, which wraps the gant goals as maven goals.

/usr/jdk/jdk/bin/java \
-Dclassworlds.conf=/usr/local/apache-maven-2.0.8/bin/m2.conf \
-Dmaven.home=/usr/local/apache-maven-2.0.8 \
-Dfile.encoding=US-ASCII \
-classpath /usr/local/apache-maven-2.0.8/boot/classworlds-1.1.jar org.codehaus.classworlds.Launcher \
--no-plugin-registry --fail-fast --no-plugin-updates --strict-checksums \
-f /home/leipzig/Documents/renewalWeb/pom.xml \

This appears to allow changes to be detected and my depedencies to be found and also managed by maven.

Comment actions Permalink

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.

Comment actions Permalink

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.

Comment actions Permalink

That's simple. If you look into your grails script and inline
startGrails call inside, you'll get a similar Java command line.

Comment actions Permalink

for some reason if I designate

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.

    development {
        dataSource {
            dbCreate = "create-drop"
            url = "jdbc:hsqldb:mem:testDb"
    test {
        dataSource {
              dbCreate = "create-drop"
              pooled = true
            driverClassName = "com.mysql.jdbc.Driver"
            url = "jdbc:mysql://"
            username = "XXXXX"
            password = "XXXXXXXXXX"

Please sign in to leave a comment.