Install SDKMAN (The Software Development Kit Manager)

Keywords: SDK Java Scala curl

SDKMAN is a tool for managing parallel versions of multiple software development toolbox based on Unix system. It provides a simple command line interface (CLI) and API for installing, converting, removing and displaying installable lists. Its predecessor is the Groovy enVironment Manager, inspired by RVM and vbenv tools that are mainly used in the Ruby community.

Characteristic

  • By Developers, for Developers
    Make life easier. No need to download many pages, decompress, add _HOME to PATH environment variables.

  • Java all the way down
    Install software toolkits for JVM s such as java, Groovy, Scala, Kotlin and Ceylon. Activator, Ant, Gradle, Grails, Maven, SBT, Spring Boot, Vert.x and many other tools are supported.

  • Lightweight
    With bash, your system only needs to install curl and zip/unzip. Even ZSH can.

  • Multi-platform
    It runs on any UNIX-based platform: Mac OSX, Linux, Cygwin, Solaris and FreeBSD. Windows users can use the Powershell client.

  • APIs
    New users can easily use the open source Broker REST API. Vendors can publish and declare their versions through a secure vendor API.

  • Get started now!
    Next, paste the following commands into the terminal and run:

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

Install SDK

  1. Run $curl -s "https://get.sdkman.io" | bash in the terminal and complete the installation according to the prompt on the screen.
  2. Open a new terminal or enter $source ($HOME/.sdkman/bin/sdkman-init.sh) at the current terminal.
  3. Run the following command to ensure that the installation is successful: sdk version, if successful, will display
    sdkman 5.0.0+51 .

Uninstall SDK

Function

tar zcvf ~/sdkman-backup_$(date +%F-%kh%M).tar.gz -C ~/ .sdkman
$ rm -rf ~/.sdkman

Install to custom location

The default is to install it under $HOME/.sdkman, so we can customize the installation location.
$ export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash .

Use

The latest stable version of the sdk option can be installed with the following command:

$ sdk install java

You will see the following output:

Downloading: java 8u111

In progress...

######################################################################## 100.0%

Installing: java 8u111
Done installing!

Next you will be prompted whether to set this version as the default version:

Do you want java 8u111 to be set as default? (Y/n):

Entering yes (or clicking the Enter key) will use this version as the default version in the shell that opens later.

Specified version

Specify the version you want to install $sdk install scala 2.12.1, and then the same.

Install local version

$ sdk install groovy 3.0.0-SNAPSHOT /path/to/groovy-3.0.0-SNAPSHOT

Remove the version already followed

$ sdk uninstall scala 2.11.6

Display Installable List

$ sdk list
This command displays an alphabetical list of installable options, each name of the list, the current stable default version, address, description and simple installation commands. Output supports pipes, so you can exit with the keyboard shortcut q.

================================================================================
Available Candidates
================================================================================
q-quit                                  /-search down
j-down                                  ?-search up
k-up                                    h-help
--------------------------------------------------------------------------------
Groovy (2.4.5)                                       http://www.groovy-lang.org/

Groovy is a powerful, optionally typed and dynamic language, with static-typing
and static compilation capabilities, for the Java platform aimed at multiplying
developers' productivity thanks to a concise, familiar and easy to learn syntax.
It integrates smoothly with any Java program, and immediately delivers to your
application powerful features, including scripting capabilities, Domain-Specific
Language authoring, runtime and compile-time meta-programming and functional
programming.

                                                            $ sdk install groovy
--------------------------------------------------------------------------------
Scala (2.11.7)                                        http://www.scala-lang.org/
...

Show a list of versions of a tool

$ sdk list groovy
This command will show the current version of SDK that is optional, local, and installed.

================================================================================
Available Groovy Versions
================================================================================
 > * 2.4.4                2.3.1                2.0.8                1.8.3
     2.4.3                2.3.0                2.0.7                1.8.2
     2.4.2                2.2.2                2.0.6                1.8.1
     2.4.1                2.2.1                2.0.5                1.8.0
     2.4.0                2.2.0                2.0.4                1.7.9
     2.3.9                2.1.9                2.0.3                1.7.8
     2.3.8                2.1.8                2.0.2                1.7.7
     2.3.7                2.1.7                2.0.1                1.7.6
     2.3.6                2.1.6                2.0.0                1.7.5
     2.3.5                2.1.5                1.8.9                1.7.4
     2.3.4                2.1.4                1.8.8                1.7.3
     2.3.3                2.1.3                1.8.7                1.7.2
     2.3.2                2.1.2                1.8.6                1.7.11
     2.3.11               2.1.1                1.8.5                1.7.10
     2.3.10               2.1.0                1.8.4                1.7.1

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

Use version

Use the given version in the current terminal:
$ sdk use scala 2.12.1
Be aware that this command only switches the optional version of the current shell. To persist this change, use the default command.

Default version

Set the given version to the default version:
$ sdk default scala 2.11.6 .

current version

View the current version:

$ sdk current java
Using java version 8u111 
$ sdk current
  Using:
  groovy: 2.4.7
  java: 8u111
  scala: 2.12.1

Expired version

Does a tool version on the system expire?

$ sdk outdated springboot
  Outdated:
  springboot (1.2.4.RELEASE, 1.2.3.RELEASE < 1.2.5.RELEASE)
$ sdk outdated
  Outdated:
  gradle (2.3, 1.11, 2.4, 2.5 < 2.6)
  grails (2.5.1 < 3.0.4)
  springboot (1.2.4.RELEASE, 1.2.3.RELEASE < 1.2.5.RELEASE)

Update settings

Use the following command to update if there is a new version:

$ sdk selfupdate

Forced reinstallation:

$ sdk selfupdate force

Refresh installation options

$ sdk flush candidates
This command clears the list of installation options. When a new terminal is opened, the latest list is pulled and stored locally.

Help

$ sdk help
Output:

Usage: sdk   [version]
       sdk offline 

   commands:
       install   or i     [version]
       uninstall or rm    
       list      or ls   
       use       or u     [version]
       default   or d     [version]
       current   or c    [candidate]
       outdated  or o    [candidate]
       version   or v
       broadcast or b
       help      or h
       offline           
       selfupdate        [force]
       flush             

   candidate  :  ...
   version    :  where optional, defaults to latest stable if not provided

eg: sdk install groovy

To configure

Configuration file ~/.sdkman/etc/config.
Currently configurable content:

# make sdkman non-interactive, preferred for CI environments
sdkman_auto_answer=true|false

# perform automatic selfupdates
sdkman_auto_selfupdate=true|false

# disables SSL certificate verification
# https://github.com/sdkman/sdkman-cli/issues/327
# HERE BE DRAGONS....
sdkman_insecure_ssl=true|false

# disable GVM alias, for users of the Go Version Manager
sdkman_disable_gvm_alias=true|false

# configure curl timeouts
sdkman_curl_connect_timeout=5
sdkman_curl_max_time=4

# subscribe to the beta channel
sdkman_beta_channel=true

SDK Installable Options

  • Activator (1.3.10)
    Typesafe is a GUI/CLI tool used to help build response systems. It uses SBT (simple build build build) to build, run, and test projects. It provides a code editing interface, as well as templates and seeds for clone and use.
    $ sdk install activator

  • Ant (1.10.0) (without explanation)
    https://ant.apache.org/
    $ sdk install ant

  • AsciidoctorJ (1.5.5)
    http://asciidoctor.org/
    AsciidoctorJ is an official library that runs AsciidoctorJ on a JVM. Through Asciidoctor, java or other JVM languages can be transformed into AsciiDoc content or the analysis structure of the parsed AsciiDoc documents.
    $ sdk install asciidoctorj

  • Ceylon (1.3.2)
    http://ceylon-lang.org/
    Ceylon is a modern, modular, static programming language for java and js virtual machines. The language is characterized by flexibility and readability, a unique and uncommon elegant static type system, powerful module structure and excellent tools.
    $ sdk install ceylon

  • -

Posted by jkohns on Sat, 15 Dec 2018 17:21:03 -0800