Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Grails' Groovy version

Tags:

grails

groovy

How can I change the groovy version used by Grails 1.3.7 to groovy 1.7.9?

I'm having this problem in a Grails 1.3.7 application in which every minute a Quartz process instantiates some 500 new objects like this:

class Foo{
 Bar bar
 Date d = new Date()
 int v
}

def f = new Foo(bar:b, v:value)

What I'm observing is that on each run, this is taking longer. At first, it takes a few nanoseconds, but by the time the application crashes with a PermGen out of memory error, this process takes, sometimes, more than 10 seconds... to instantiate an object!

I've take a few Heap Dumps and found that a CallSiteClassLoader was taking an enormous amount memory from previously instated objects. After reading this thread I decided to directly change the groovy jar's in my WAR. Now the application is running smoothly as it should, and again, after a few Heap Dumps, there seem to be no memory leaks.

But each WAR I generate, keeps coming with groovy 1.7.7 and I have to manually change it.

Thanks!

like image 705
Eldelshell Avatar asked Mar 11 '11 17:03

Eldelshell


1 Answers

You could uncomment mavenCentral() (under repositories) and add dependency

compile 'org.codehaus.groovy:groovy-all:1.7.9'

(under dependencies) in BuildConfig.groovy.

Don't know if this is recommended. At least the build will package your application with groovy 1.7.9 like you do manually now. grails run-app will still use 1.7.7 I guess, but that's probably not an issue, as you might restart before running into permgen problems during development.

I chose to stay on Grails 1.3.6 until a Grails version with Groovy 1.7.9 or higher is released.

like image 110
rlovtang Avatar answered Sep 22 '22 23:09

rlovtang