Speed Up Your Dev Setup With Sdkman

How often has it happened that you move to a different project and are provided a new machine to work on? However exciting it may make you feel, the thing that you dread the most is lurking just around the corner. The next immediate task that you are expected to do is setup the damn machine with your usual bells and whistles before you can even start writing a single line of code. The same is true if you managed to swipe out the OS from your laptop and start putting the bits and pieces all over again. The entire process isn’t difficult or near impossible for an advanced developer, but it is better if we label this activity as a waste of time and only wish if there were ways to speed it up.

This is the void which sdkman fills. And I have grown to like this approach to setup my machine. Head over to the sdkman homepage and you will realize what I am trying to say.

Installing sdkman on Linux is a breeze. Just fire up

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

and follow instructions on the screen.

Once sdk in installed, its just a matter of few more commands to quickly have a working dev setup up and running. sdk has a list of handy commands which are listed below

sdk list – lists all the different software development kits available for installation including jvms for java.
sdk list [name] – lists all versions of the required sdk eg Java, Maven, Gradle etc
sdk install [name] – installs the latest stable version of the required sdk
sdk install [name] [identifier] – installs the specified version of the sdk, in case you wish to use an older, more specific version.

Armed with this knowledge lets see how I proceeded to setup a dev machine. First activity ofcourse is to install a jdk.
sdk list java will list out all versions from all vendors available and provide identifiers which we will use when proceeding with installation. So say we wanted to install java 11 from AdoptOpenJDK the command to install it would simple be sdk install java 11.0.4.hs-adpt by using the identifier for installation.

List of available versions with indentifier for installation.

Some linux flavors come with openjdk preinstalled, in which case the step to install java can be skipped.

Moving ahead to install other things was simply invoking the following commands

sdk install gradle 5.5.1
sdk install maven 3.6.1
sdk install springboot 2.1.7.RELEASE

sdk manages adding these libs to be path and making sure developers don’t need to mess with the settings and thus making their life a bit easier.

sdkman documentation says it runs on any UNIX based platforms: Mac OSX, Linux, Cygwin, Solaris and FreeBSD. But as a hack, I found this to work on Windows as well using the Git Bash. The only issue was git bash does not have zip executable which is required for installing sdkman itself. As a workaround, since I had 7zip installed on windows, I simply made a copy of 7z.exe, renamed it to zip.exe and made sure this file is on the git bash path. This fooled sdkman into thinking the required dependencies exist and it went ahead without any hassle.

Then all that is left is to install any IDE like IntelliJ and/or text editor like sublime text and trance away into coding heaven.