jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
10.32k stars 295 forks source link

"No metadata found for version corretto-21" using the java installer #1990

Closed dkowis closed 7 months ago

dkowis commented 7 months ago

Describe the bug I keep my java version only at the latest major, so that it will automatically pull in and install the various patch levels. so the version for java is corretto-21

To Reproduce mise install java@corretto-21

Expected behavior mise would go get and install the latest java corretto-21.0.whatever

❯ mise ls-remote java | grep corretto-21
corretto-21.0.0.34.1
corretto-21.0.0.35.1
corretto-21.0.1.12.1
corretto-21.0.2.13.1
corretto-21.0.3.9.1

mise doctor output

version: 2024.4.9 macos-arm64 (2024-04-29)
activated: yes
shims_on_path: no

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Mon, 29 Apr 2024 17:57:20 +0000
  Rust Version: rustc 1.77.1 (7cf61ebde 2024-03-27)
  Profile: release

shell: 
  /opt/homebrew/bin/fish
  fish, version 3.7.1

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml

backends: 
  cargo
  go
  npm
  pipx
  ubi

plugins: 
  bun        (core)
  deno       (core)
  go         (core)
  gradle     https://github.com/rfrancis/asdf-gradle.git#9a2ca80
  java       (core)
  krew       https://github.com/bjw-s/asdf-krew.git#af1a2cb
  kubectl    https://github.com/asdf-community/asdf-kubectl.git#cbe6df4
  node       (core)
  python     (core)
  ruby       (core)
  terraform  https://github.com/asdf-community/asdf-hashicorp.git#c44c314

toolset: 
  ruby@3.3.0        
  node@20.12.2      
  java@corretto-21  (missing)
  terraform@1.4.7   
  python@3.12.1     

env_vars: 
  MISE_SHELL=fish

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = false
  python_default_packages_file = "/Users/TKA14MZ/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
1 problem found:

1. unused shims are present, run mise reshim to remove them
   Unused shims: kubectl-krew

Additional context I suspect this is a regression, as it worked up until today, at the latest version of mise v2024.4.9 that I just installed via cargo

roele commented 7 months ago

Most likely caused by #1957 which tightens the fuzzy matching to prevent installing the newest version for e.g. openjdk-21, oracle-21, sapmachine-21 etc. These distributions have major versions without minor/patch version numbers and could therefore not be installed reliably. Especially if you want a x.0.0 version or you need to switch between x.0.0 and x.0.x versions.

To have always the newest version of a distribution installed i suggest to use the prefix: scope. For example mise use java@prefix:corretto-21.

roele commented 7 months ago

@jdx #1887 should be re-opened in case of revert. We could adapt the fix #1957 to apply only for certain distributions liberica, liberica-lite, openjdk, oracle, oracle-graalvm and sapmachine. This would fix both issues but keep the inconsistencies, corretto-21 installs newest while openjdk-21 does not. On the other hand there will be no way to install openjdk-21(.0.0) otherwise.

jdx commented 7 months ago

yeah I think the best solution is to special-case these. Thankfully new java distros don't pop up super frequently

roele commented 7 months ago

Okey, will have another look at that tomorrow.