Java Reference
In-Depth Information
$ gvm use groovy [version]
If the version you request isn't installed, GVM will download and install it for you. In
my own work, I don't switch Groovy versions that often, but I switch Grails versions fre-
quently and the same tool works for Groovy, Grails, Griffon, and a few other software
distributions. GVM installs software under a .gvm folder in your home directory, so you
should set the
GROOVY_HOME
variable to point there. For example, on my Mac, I have
$ export GROOVY_HOME=/Users/kousen/.gvm/groovy/current
That's useful because switching versions through GVM updates the current link. I don't
have to explicitly add that folder to my path, though, because the tool adds soft links to a
bin folder already in my path.
A.3. Testing your installation
The easiest way to see if your Groovy installation is working is to try out the Groovy shell
or the Groovy console. If you type
$ groovysh
you should get a response like this:
Groovy Shell (2.1.5, JVM: 1.7.0_11)
Type 'help' or '\h' for help.
------------------------------------
groovy:000> println 'Hello, World!'
Hello, World!
===> null
groovy:000>
sponse here is
null
because the
println
command has a
void
return type.
3
Read-Eval-Print-Loop, discussed further in
appendix B
.
The Groovy console is a bit more useful. Start it with this command:
$ groovyConsole