I'll still just a pup when it comes to using Groovy's and Grails' tools. I want to use groovyConsole to test some ideas. The code I want to try involves using Grails converters, json to be exact. I found a nice post that explains how to do this by adding classes to groovy-starter.conf rather than messing around with ClassPath. The last time I tried adding ClassPath all kinds of things went haywire on me!
So I like this idea of adding the code to groovy-starter.conf. I have located that file in $GROOVY_HOME/conf. Here's the article I speak of: DRY Groovy, How To Get Groovy To Import A Class Into a Script
The problem: I don't know exactly what to add to this. I want to add import grails.converters.json
to my groovyConsole script. But being a newb I am not clear on what magic incantation I put in groovy-starter.conf!
I am thoroughly enjoying my newfound love for Groovy, but get a little frustrated when I can't get Google to cough up an answer to my questions. I think I have 75% of the answer but could use a little more guidance. I have JDK 1.6, Groovy 1.6.5 and grails-1.3.5 installed on this system. What magic words will fix my groory-starter.conf so I can access the Grails converters?
You can run
grails console
instead ofgroovyConsole
- it does load all the application classes, has a database connection and everything.OTOH, speaking of classes fro
groovyConsole
, you need to load a lot -$GRAILS_HOME/dist/grails-web-1.3.5.jar
, and all of its dependencies likegrails-core-1.3.5.jar
and mode from$GRAILS_HOME/lib/
.