Methods & Tools Software Development Magazine

Software Development Magazine - Project Management, Programming, Software Testing

 

GVM, the Groovy enVironment Manager

Marco Vermeulen, http://wiredforcode.com, @gvmtool, @marcoVermeulen

Groovy enVironment Manager (GVM) is an open source 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. GVM is currently focused on the Groovy ecosystem, but will soon support other communities too.

Web Site: http://gvmtool.net/
Version: 1.3.12
System Requirements: Mac OSX, Linux, Cygwin, Solaris, FreeBSD
License and Pricing: Apache 2.0, Free OSS
Support: https://github.com/gvmtool/gvm/issues

Developers spend most of their time writing code. In order to do this they make extensive use of tools. One of the most basic tools used by developers is a Software Development Kit, or SDK.

Wikipedia defines an SDK as follows: "A software development kit (SDK or "devkit") is typically a set of software development tools that allows for the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar development platform."

When dealing with Java technology, developers constantly need to search for, download and install these SDKs in order to perform their development. This in itself is not a very complex task, but is certainly mundane and time consuming. Wouldn't it be nice if we could delegate this laborious task elsewhere? Such a solution exists, and is called GVM, the Groovy enVironment Manager.

As a Groovy and Java developer, I had experienced this pain once too often. Not only did I need to install SDKs, but also needed to manage multiple versions side-by-side. I realized that I was not the only person having to do this often, so I embarked in writing an SDK manager to solve this problem once for all.

GVM went live in December 2012, and is still under active development. With over 23,500 installations worldwide at the time of writing, it is currently the preferred way of installing Groovy related technologies. However, it will soon become available for other Java related stacks such as Scala, Clojure and even Java too!

Key Concepts

GVM has a concept of Candidates and Versions. Candidates are SDK types, and each type can have multiple Versions. Examples of Candidates are Grails, Gradle, or even Groovy itself. Every Candidate has a default Version that is always set to the latest stable release. GVM will notify you when a new Version of a Candidate becomes available, and will allow for easy installation by issuing a single command. Even if you're not a programmer, the use of GVM is so simple that you can follow along easily. So please open a terminal and try this out!

Installation

Installing GVM is a very simple process. First, some prerequisites:

  • a machine running some variant of Unix (Mac and Linux or even Windows with Cygwin will do!).
  • curl (for downloading)
  • zip (to handle the downloaded archives)
  • sed (for string processing)
  • a pre-installed Java SDK

When running the GVM installer, it will check for the presence of these on your system and ask you to install them if they are not present.

To run the installer, enter the following in a terminal:

$ curl -s get.gvm.io | bash

If all is well, you should see a message confirming that GVM is installed. Now close the current terminal and open a new one to start using GVM!

Usage

GVM has a bash client, allowing you to enter commands from the command line. This allows management of Candidate Versions with ease. For instance, to install the default version of Groovy, enter the following:

$ gvm install groovy

The tool will now download and install the latest version of Groovy and place it on your path ready for use. After watching the download complete and answering `Y` to the question of making it your default version, enter the following to verify that you have installed groovy successfully:

$ groovy -version

If all went well, you should see something like:

Groovy Version: 2.2.0 JVM: 1.7.0_45 Vendor: Oracle Corporation OS: Linux

To get a specific Version in parallel to the one already downloaded:

$ gvm install groovy 2.1.9

To switch to another version:

$ gvm use groovy 2.2.0

Removing a version is as simple as:

$ gvm uninstall groovy 2.1.9

To see a list of all available Versions for a Candidate, enter:

$ gvm list groovy

Which renders something like:

   =========================================
   Available Groovy Versions
   =========================================
    > * 2.2.0                2.0.4
      * 2.1.9                2.0.3
        2.1.8                2.0.2
      * 2.1.7                2.0.1
      * 2.1.6              + 2.0.0-beta-1
      * 2.1.5                2.0.0
   =========================================
   + - local version
   * - installed
   > - currently in use
   =========================================

Documentation

Of course, this is only the start of what GVM can do. For basic documentation, please visit our web site. For a comprehensive list of usage scenarios, please have a look at our body of Cucumber specifications that reside on GitHub: https://github.com/gvmtool/gvm/tree/master/src/test/cucumber/gvm

Summary

GVM is the Groovy enVironment Manager. It is a tool used by developers to manage Groovy Software Development Kits (SDKs) on their workstations. It automates and eases the mundane task of downloading and installing SDKs, freeing up developers to focus on more important tasks at hand. In addition it allows for easy switching between different versions of an SDK during development. GVM is currently available for Groovy related technologies, but will soon be available for other Java stacks too.


More Groovy Content


Click here to view the complete list of tools reviews

SpiraTeam Agile ALM


Software Testing Magazine

Scrum Expert