How can I run Griffon with a version of Groovy other than the bundled one?
There are several reasons to do so, here's one. Griffon has its own release cycle (as a matter of fact it just had a release earlier today) and as such it might not bundle the latest Groovy release (the latest stable one is 1.7.10 as a matter of fact) so what can you do if you want to test the bleeding edge (Groovy 1.8-rc2), say those nice new AST transformations like @Log, @Canonical and the like? Well, here's a quick way to do it. It is not as simple as replacing a jar file and flipping a switch but it's certainly doable.
Follow these steps to get the job done.
- Locate a suitable jar for the Groovy version you want to use, say 1.7.10. Download it and place it under $GRIFFON_HOME/lib.
- Delete the old Groovy version. In Griffon 0.9.2 it's $GRIFFON_HOME/lib/groovy-all-1.7.6.jar.
- Locate $GRIFFON_HOME/bin/startGroovy (startGroovy.bat if you're on Windows) and edit it. Search for the Groovy version you're exchanging (1.7.6 in this case) and change it to the target version you want.
STARTER_CLASSPATH="$GRIFFON_HOME/lib/groovy-all-1.7.6.jar:$GRIFFON_HOME/dist/griffon-cli-0.9.2.jar:$GRIFFON_HOME/dist/griffon-rt-0.9.2.jar"
changes to
STARTER_CLASSPATH="$GRIFFON_HOME/lib/groovy-all-1.7.10.jar:$GRIFFON_HOME/dist/griffon-cli-0.9.2.jar:$GRIFFON_HOME/dist/griffon-rt-0.9.2.jar" - Now comes the tricky part. Locate $GRIFFON_HOME/dist/griffon-cli-<version>.jar and unzip it to a directory of your choosing. We'll edit a properties file and repackage the jar
$ cd /tmp
$ unzip -dgriffon $GRIFFON_HOME/dist/griffon-cli-0.9.2.jar
$ vim griffon/build.properties
(edit 1.7.6 to 1.7.10; save the file)
$ cd griffon
$ jar cvf $GRIFFON_HOME/dist/griffon-cli-0.9.2.jar . - The last and final step is clearing the Ivy cache if you have run Griffon before
$ rm -rf $USER_HOME/.ivy2/cache/org.codehaus.griffon/griffon-cli
You might be wondering, why the complication? why not just replace a jar and be done with it? Well it turns out that Griffon has an internal DependencyManager that knows how to handle the set of bootstrap dependencies. This set is controller by the build.properties file we jus edited. Without those changes the default unchanged dependencies will be used. Now, what was that about applying @Canonical to Model classes?

Keep on Groovying!