asdf-java icon indicating copy to clipboard operation
asdf-java copied to clipboard

more major release identifiers

Open xenoterracide opened this issue 4 years ago • 6 comments

Specifically, I'd like to be able to do adoptopenjdk-11 as I am rarely interested in a specific patch release, but want the latest of a given version.

Ideally, I might also have adoptopenjdk-lts. I would think it would be good to have these for all the different jdk's ( god oracle, what a mess, :/ ). Also, maybe, adoptopenjdk-latest.

Just trying asdf out, so I'm not certain how easy this is.

xenoterracide avatar Aug 12 '21 01:08 xenoterracide

This feature is already available using the latest syntax. From the help:

asdf install <name> latest[:<version>]  

Install the latest stable version of a package, or with optional version, 
install the latest stable version that begins with the given string

For your specific case, the command would be:

asdf install java latest:adoptopenjdk-11

There are currently three LTS versions of Java: 8, 11, and 17. You can use the above command to install your desired version, substituting the appropriate version number.


You could also create or add to your .tool-versions file so it contains (for example):

java latest:adoptopenjdk-8 latest:adoptopenjdk-11 latest:adoptopenjdk-17

Then run the following command to install the latest version of all three LTS versions.

asdf install

Docs for the .tool-versions file.

MrPilotMan avatar Nov 25 '21 03:11 MrPilotMan

doesn't appear to work, sorry for the long delay on reply

❯ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
❯ asdf install java latest:openjdk-17
java openjdk-17.0.1 is already installed
❯ avahi-browse --all -v -r -t
❯ asdf install
java openjdk-17 is already installed
nodejs lts is already installed
❯ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

just for clarities sake I've also tried exiting my shell/terminal after.

❯ asdf plugin update --all
Updating nodejs to master
From https://github.com/asdf-vm/asdf-nodejs
   95a2091..ed34355  master     -> master
   95a2091..ed34355  master     -> origin/master
Already on 'master'
Your branch is up to date with 'origin/master'.
Updating java to master
From https://github.com/halcyon/asdf-java
   a6dd71a..754b212  master     -> master
   a6dd71a..754b212  master     -> origin/master
Already on 'master'
Your branch is up to date with 'origin/master'.
❯ asdf --version
v0.8.1
❯ asdf install java latest:adoptopenjdk-17
java adoptopenjdk-17.0.1+12 is already installed
❯ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

xenoterracide avatar Jan 07 '22 17:01 xenoterracide

I just installed asdf-java

asdf install java latest:adoptopenjdk-11 worked

Someone should add some example commands to the README

Side note: running asdf list-all java - while technically performing its function - is practically useless for trying to understand the latest releases - it floods the CLI.

tony avatar May 03 '22 15:05 tony

hey, could these examples be added to the readme ^. because I went to look this up here when I couldn't find it. Which kind of sucks.

xenoterracide avatar Aug 18 '22 12:08 xenoterracide

I would but not allowed to per work policy/proxy and not doing hobby coding atm

xenoterracide avatar Aug 18 '22 12:08 xenoterracide

FWIW I don't think this works for graalvm, because there are jdk17 and jdk11 versions (and they come at the end of the version string, so prefix matching doesn't really work)

lvh avatar Aug 28 '22 17:08 lvh