halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
454 stars 86 forks source link

more major release identifiers #160

Closed xenoterracide closed 1 year ago

xenoterracide commented 3 years ago

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.

MrPilotMan commented 2 years ago

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.

xenoterracide commented 2 years ago

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)
tony commented 2 years ago

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.

xenoterracide commented 2 years ago

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 commented 2 years ago

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

lvh commented 2 years ago

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)