SDKMAN! The Software Development Kit Manager

Posted on January 24, 2017 · 3 min read

In this post I'd like to make a quick overview of SDKMAN!, the tool I use to manage SDKs. Most of the content, if not all, is already present in its website. I just aim to make a straightforward introduction to it but all credit goes to its maintainer, Marco Vermeulen.

Highlights

  • It makes life easier. There's no need to mess with environment variables such as PATH
  • It's multi-platform
  • There are many SDKs available: Java, Scala, Groovy, Spring Boot and more
  • And also build tools such as Maven, Sbt or Gradle
  • It allows to manage multiple versions of each one
  • Lightweight: it's written in bash and only requires curl and unzip to run

Installation

Installing SDKMAN! just requires opening a terminal and entering:

curl -s "https://get.sdkman.io" | bash

This will download and install SDKMAN! in $HOME/.sdkman by default. The associated CLI command is sdk.

Usage

There are mainly two kinds of commands available in sdk:

  • Commands to manage candidates (SDKs and other tools):
    • install or i: install a candidate version
    • uninstall or rm: uninstall a candidate version
    • list or ls: list available candidate versions
    • use or u: use a candidate version in current shell
    • default or d: set the default candidate version for every shell
    • current c: display current candidate version
    • upgrade or ug: upgrade outdated candidate version
  • Utility commands:
    • version or v: display the current version of sdk
    • broadcast or b: display the last broadcast message
    • help or h: show the sdk help message
    • offline: enable or disable offline mode
    • selfupdate: update the sdk
    • flush: flush sdk local state

The most relevant and interesting are the ones to manage candidates.

With sdk list we can list all the available candidates. These are the ones currently available:

  • Activator
  • Ant
  • AsciidoctorJ
  • Ceylon
  • CRaSH
  • Gaiden
  • Glide
  • Gradle
  • Grails
  • Griffon
  • Groovy
  • GroovyServ
  • Java
  • JBake
  • JBoss Forge
  • Kobalt
  • Kotlin
  • Lazybones
  • Leiningen
  • Maven
  • sbt
  • Scala
  • Spring Boot
  • Sshoogr
  • Vert.x

For example, let's say we want to install the Scala SDK. First we can list the available Scala versions by running sdk list scala:

==========================
Available Scala Versions
==========================
     2.12.1
     2.12.0
     2.11.8
     2.11.7
     2.11.6
     2.11.5
     2.11.4
     2.11.3
     2.11.2
     2.11.1
     2.11.0

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

If we just want the latest version, all we need to do is run sdk install scala, but if we want to install a specific version we can specify it as well by running sdk install scala 2.12.0.

When having multiple versions installed, sdk current scala will show the current version in use. Then, running sdk use scala 2.12.0 will switch the candidate version for the current terminal. On the other hand, running sdk default scala 2.12.0 will make the switch global and permanent.

In conclusion

That's pretty much all you need to start using SDKMAN!. I have nothing against installing the SDKs through the official channels but if you use many of them at the same time, keeping them up to date and managing multiple versions of each one can become a pain.

This tool surely makes it easier.


Comments

Would you like to leave a comment? Since this blog is hosted on GitHub Pages there's no straightforward way to do so.

Instead, you can add a comment in this GitHub issue. If you'd like to see it here, refresh this page after posting the comment.