GVM the Groovy enVironment Manager
GVM is a tool for managing parallel Versions of multiple Software Development Kits on most Unix based systems. It provides a convenient command line interface for installing, switching, removing and listing Candidates.
Candidates that are currently supported are:
This list will grow beyond Groovy candidates.
It runs on the following platforms:
- Mac OSX
- FreeBSD (with bash installed)
GVM is written in bash and only depends on curl and unzip to be available on your system. The installer will check for these before completing the installation process. It will then create a
.gvm/ folder in your home directory, and neatly install all candidates beneath it.
GVM also has a server-side component written with vertx for dynamic behaviour. Further it uses MongoDB for keeping track of Candidate Versions and persisting some usage statistics. As a result, newly released Candidate Versions can be added to GVM without the need for local re-installation.
It also facilitates easy installation and a selfupdate feature to upgrade client-side components. It even sports a facility for live broadcast notifications.
Open your favourite bash terminal and enter the following:
curl -s get.gvmtool.net | bash
If the environment needs tweaking for GVM to be installed, the installer will prompt you accordingly and ask you to restart.
After installation, you will need to run the code snippet that the installer prompts you to. Alternatively you could open a new terminal. Next, run the following:
$ gvm help
If GVM was installed correctly, you should see some basic help information:
[version] gvm offline ... candidate : gradle, grails, griffon, groovy, groovyserv, lazybones, vertx version : where optional, defaults to latest stable if not provided eg: gvm install groovy
Install the current default grails version by simply typing:
$ gvm install grails
You will be prompted if you want this version to be set as default. Answering yes will ensure that all shells opened will have this version immediately in use.
After installation completes, install another version:
$ gvm install grails 1.3.9
This will install a parallel version of Grails, allowing you to switch between them easily.
It is even possible to add a locally installed development snapshot/version to GVM. This is done by using the install command as follows:
$ gvm install grails 3.0-SNAPSHOT /home/dude/git/grails
This variant of
install can only be executed if the specified version is not known. Otherwise, the path provided will be ignored and the correct version will be downloaded instead.
Choose to use a given version:
$ gvm use grails 2.1.1
It is important to realise that this will switch the candidate version for the current shell only. To make this change permanent, use the
default command instead.
Chose to make a given version the default:
$ gvm default grails 1.3.9
This will ensure that all subsequent shells will start with version 1.3.9 in use.
To see what is currently in use for a Candidate:
$ gvm current grails Using grails version 2.2.0
To see what is currently in use for all candidates:
$ gvm current Using: groovy: 2.1.0 grails: 2.2.0 griffon: 1.2.0 gradle: 1.3 vertx: 1.3.1.final
To get a listing of what is available, installed and selected:
$ gvm list gradle
This command will also indicate any locally installed dev versions that you might have added to GVM.
To remove the versions you aren't using anymore:
$ gvm uninstall grails 1.3.9
You can also view the latest broadcast message:
$ gvm broadcast
GVM has the ability to update itself. If you are being nagged about an outdated GVM version:
It's also useful to know that suggestive and automatic selfupdate modes are availabe. See the Configurations section below.
$ gvm selfupdate
To easily see what version of GVM you currently have installed:
$ gvm version
An Offline mode is provided allowing GVM to operate in standalone mode. It can be enabled or disabled at will.
$ gvm offline enable Forced offline mode enabled.
$ gvm offline disable Online mode re-enabled!
Although configuration is limited at the moment, the list of configurable items will grow as required. Configuration can be found in the
.gvm/etc/config file. Currently the following is configurable:
# make gvm non-interactive, great for CI environments gvm_auto_answer=false/true # prompt user to selfupdate on new shell gvm_suggestive_selfupdate=true/false # perform automatic selfupdates gvm_auto_selfupdate=true/false
And that's all there is to it!
Easy peasy pie!