SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. Formerly known as GVM the Groovy enVironment Manager, it was inspired by the very useful RVM and rbenv tools, used at large by the Ruby community.
Install
1
2
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
Usage
-
Check version
1
sdk version
-
Install java
1
sdk install java
-
Specify version
1
sdk install scala 3.2.1
-
Remove version
1
sdk uninstall scala 3.2.1
-
List candidates
1
sdk list
-
List versions
1
sdk list groovy
-
Use version
1
sdk use scala 3.2.1
-
Default Version
1
sdk default scala 3.2.1
-
Current Version(s)
1 2
sdk current java sdk current
-
Env Comomnad
Want to switch to a specific JDK or SDK every time you visit a project?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# generate the .sdkmanrc file sdk env init # To switch to the configuration present in your .sdkmanrc file, sdk env # When leaving a project, you may want to reset the SDKs to their default version. sdk env clear # After checking out a new project, you may be missing some SDKs specified in the project's .sdkmanrc file. To install these missings SDKs, sdk env install # Do you want to switch SDK versions automatically when you cd into a directory? This can be done by setting the sdkman_auto_env=true in the SDKMAN configuration. sdkman_auto_env=true
-
Updrade Version
1 2
sdk upgrade springboot sdk upgrade
-
Display Sdkman Version
1
sdk version
-
Broadcast Messages
Get the latest SDK release notifications on the command line
1
sdk broadcast
-
Offline Mode
1 2
sdk offline enable sdk offline disable
-
Self-Update
1 2 3
sdk selfupdate # reinstall sdk selfupdate force
-
Update Candidates
1
sdk update
-
Flush
1 2 3 4 5 6 7 8 9 10 11
# flush SDKMAN!'s local state. sdk flush # Clears out the broadcast cache, downloading the latest available news on next command invocation. sdk flush broadcast # Cleans the cache containing all downloaded SDK binaries. This can take up a lot of space so is worth clearing out from time to time! sdk flush archives # Clears out the staging work folder used when installing new versions of candidates and SDKMAN! itself. sdk flush tmp
-
Home
When using SDKMAN in scripts, it is often useful to get the absolute path of where an SDK resides (similar to how the
java_home
command works on macOS).1
sdk home java 17.0.6-tem
-
Help
1
sdk help
-
Configuration
~/.sdkman/etc/config
Tthe
sdk config
command may be issued to edit this file in the system editor.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# make sdkman non-interactive, preferred for CI environments sdkman_auto_answer=true|false # check for newer versions and prompt for update sdkman_selfupdate_enable=true|false # disables SSL certificate verification # https://github.com/sdkman/sdkman-cli/issues/327 # HERE BE DRAGONS.... sdkman_insecure_ssl=true|false # configure curl timeouts sdkman_curl_connect_timeout=5 sdkman_curl_continue=true sdkman_curl_max_time=10 # subscribe to the beta channel sdkman_beta_channel=true|false # enable verbose debugging sdkman_debug_mode=true|false # enable colour mode sdkman_colour_enable=true|false # enable automatic env sdkman_auto_env=true|false # enable rosetta2 compatibility for apple silicon sdkman_rosetta2_compatible=true|false # enable bash or zsh auto-completion sdkman_auto_complete=true|false
References
https://sdkman.io/install