Wired For Code

all things JVM on Unix

Groovy enVironment Manager API

Groovy enVironment Manager API

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.

It has two main components: the first is a series of bash scripts; the second is a simple lightweight API that the clientside code calls in order to fulfill it’s functions.

Even though the API’s primary purpose has been to serve the clientside bash scripts, it can very easily be utilised by other clients. Examples of this could be an IntelliJ or Eclipse plugin, a rich GUI client (perhaps written in Griffon) or a Windows batch script like Gravy.

To help developers getting started, here follows a list of endpoints, along with request parameters and results:

All Candidates

http://api.gvmtool.net/candidates

Gets all candidates available on GVM.

Result: A comma separated list of candidates of all supported candidates.

gradle, grails, griffon, groovy, vertx

All Candidate Versions

http://api.gvmtool.net/candidates/{candidate}

Example: http://api.gvmtool.net/candidates/gradle

Result: A comma separated list of versions: 0.7, 0.8, 0.9, 0.9.1, 0.9.2, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5

Default Candidate Version

http://api.gvmtool.net/candidates/{candidate}/default

Example: http://api.gvmtool.net/candidates/grails/default

Result: The default version of the candidate: 2.2.1

Candidate Version List

http://api.gvmtool.net/candidates/{candidate}/list

Will render a neat list report of the candidate versions, as well as what is installed and currently active.

Example: http://api.gvmtool.net/candidates/gradle/list?current=1.5&installed=1.3,1.4,1.5

Parameters:

  • current : The current active version.
  • installed : A CSV list of currently installed versions.

Result: A neat list of candidate versions:

============================================================
Available Gradle Versions
============================================================
 > * 1.5
   * 1.4
   * 1.3
     1.2
     1.1
     1.0
     0.9.2
     0.9.1
     0.9
     0.8
     0.7

============================================================
+ - local version
* - installed
> - currently in use
============================================================

Candidate Version Download

http://api.gvmtool.net/candidates/{candidate}/{version}/download

Will redirect to the appropriate candidate version for download.

Example: http://api.gvmtool.net/candidates/groovy/2.1.3/download

Result: The zip archive: groovy-2.1.3.zip

Candidate Version Validation

http://api.gvmtool.net/candidates/{candidate}/{version}/validate

Example: http://api.gvmtool.net/candidates/groovy/2.0.0/validate

Result: The validity of the candidate version combination. valid or invalid

API Version

http://api.gvmtool.net/candidates/api/version

Example: http://api.gvmtool.net/candidates/api/version

Result: The current version deployed. 0.9.6

API Broadcast

http://api.gvmtool.net/api/broadcast

Parameter:

  • version : optional, will return upgrade message if not matching current api version.

Example: http://api.gvmtool.net/api/broadcast/0.9.6

API Alive

http://api.gvmtool.net/api/alive

Result: Checks if the service is running: OK