-
-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to manage aliases for a major version of a tool #603
Comments
This is a feature that I miss from jEnv. I can't remember all the specific names/versions of the things I have installed, particularly JDKs. But I know I want to use "java 8" (whichever specific version is installed). |
Hey @marc0der, are there any plans to add support for this? The proposal has accumulated quite a few of 👍 from the community. Thanks! |
@vpavic I would love to develop this feature, although I realise that it will have huge impact on both the backend and cli components of the project. Since sdkman is an open source project developed in my spare time, I currently don't have enough time available to pull this off alone. The options would be:
|
I am creating and using a script like this ( # check .bashrc
export SDKMAN_DIR="/Users/user/.sdkman"
[[ -s "/Users/user/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/user/.sdkman/bin/sdkman-init.sh"
sdk offline disable > /dev/null
MAJOR_VERSION="$1"
export JDK_VERSION=`sdk list java | grep -E "installed|local only" | awk '{print $NF}' | grep "^$MAJOR_VERSION" | sort -rn | head -1`
if [[ -z "$JDK_VERSION" ]]; then
echo "not find jdk major version: $MAJOR_VERSION"
exit;
fi
echo -e "find jdk version: \033[1m${JDK_VERSION}"
sdk default java "$JDK_VERSION"
sdk offline enable > /dev/null using $ ./sdkjava.sh 8
-e find jdk version: 8.0.222.hs-adpt
-e Using java version 8.0.222.hs-adpt in this shell. But I don't know how to clear the following two lines and write a script. (This code is included in export SDKMAN_DIR="/Users/user/.sdkman"
[[ -s "/Users/user/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/user/.sdkman/bin/sdkman-init.sh" |
Hi, I've just created a simple script for switching between major Java versions: https://github.com/ldziedziul/j |
This would be great, esp. for setting up SDKs in IDEA (or other IDEs); reconfiguring after every bugfix release is a hassle. As long as candidates use regular versions, all is good. Java, however, breaks all the assumptions.
|
Allow me to propose the following use cases that I proposed on https://sdkman.slack.com/archives/CJK9DMV6V/p1635547088005000 : "SDKman: if there is already a Java 11 version installed, use whichever one is first on the list of installed Java 11 versions. If none is loaded, then tell the user that they need to install a Java 11 version of some sort through SDKman" |
The major use case of this for me would be to be able to have portable I can commit a file with Ideally we could just put |
@marc0der if you point me in the right direction, this is a big enough pain point for me, that I might take some time to do this. |
A potential poor-man's solution to this is to "install a local version" that's at the same path of an already-installed java:
It's 'shallow' - |
I like the approach as a workaround, but enhanced the command to:
This way I do not have to know where SDKman installs its versions to and I can easily upgrade my version alias by running:
Just a little improvement, though, but its enough to create a shell function that takes two parameters (majorVersion, fullVersion):
At least, this saves me a bit of time in my weekly update workflow. |
This would be a great feature. I'd also suggest some (optional) way to scope by 'type'. So basically, for most cases what's already covered here install/use/etc 'java 11'. But something like '.. java 11-amzn', might be useful as well. In most cases you don't really care, but i can see it mainly being useful if you want say GraalVM in certain situations. Also, with this in place, would be nice to have a way to scope updates. where one could do something like |
As discussed in the sdkman/user-issues, it would be nice to have SDKMAN provide a way to manage additional aliases which would point to the latest major version of a tool.
This would be of great help when working with IDEs, since we would have a well defined aliases of, for example, major JDK releases: JDK 8, JDK 7, etc. So when a new update of a given JDK release would be installed, the alias would be updated to point to it and therefore no change to IDE configuration would be required.
I'm currently managing something like this by manually creating symlinks:
Which results in:
/cc @joshuawhite929
The text was updated successfully, but these errors were encountered: