-
Couldn't load subscription status.
- Fork 505
Description
Describe the bug
SdkMan provides a simple way to switch between various versions of some programs. The settings can be global or per-shell. The per-shell settings seems to be lost of the command is executed.
To Reproduce
Steps to reproduce the behavior:
- Install SDK:
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
- Install two different versions of maven
sdk install maven 3.8.8
sdk install maven 3.9.6
- Use 3.9.6 as the default
sdk default maven 3.9.6
- Verify selecting a different version in the current the shell
(sdk use maven 3.8.5 && mvn -v)
The output contains Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
5. Verify selecting a different version which should persist
sdk use maven 3.8.5
and later
mvn -v
The output contains Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Expected behavior
The sdkman shell settings should be persisted in the session.
Analysis
It seems that SdkMan directly changes the PATH variable to point to the correct tool version, see https://github.com/sdkman/sdkman-cli/blob/master/src/main/bash/sdkman-use.sh#L49