mason.nvim
mason.nvim copied to clipboard
Installing old JDTLS versions is not possible.
I've searched open issues for similar requests
- [X] Yes
I've recently downloaded the latest plugin version of mason.nvim
- [X] Yes
Problem description
Installing older versions of jdtls fails because there is a hardcoded timestamp in the url of the mason-schema-registry
I initially posted an issue on the mason-tool-installer repository but I think it makes more sense to post the issue here. https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim/issues/35
As one can see here there would exist a latest.txt file containing the full filename with the timestamp. Maybe it would be possible to look up the filename by first fetching https://download.eclipse.org/jdtls/milestones/1.27.1/latest.txt. That way the url is only depending on the version number and not on the timestamps.
The issue was already mentioned in a discussion so I thought I'm not alone with this problem.
Expected behavior
Specifying older versions of jdtls in :MasonInstall successfully installs them.
Affected packages
jdtls
Mason output
Failed (1)
◍ jdtls
▼ Displaying full log
Fetching available versions…
Downloading file "https://download.eclipse.org/jdtls/milestones/1.27.1/jdt-language-server-1.27.1-202309
spawn: wget failed with exit code 8 and signal 0.
Failed to download file "https://download.eclipse.org/jdtls/milestones/1.27.1/jdt-language-server-1.27.1
Installation log
4 [INFO Sun Oct 1 16:36:02 2023] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name= jdtls) {
3 version = "1.27.1"
2 }
1 [WARN Sun Oct 1 16:36:02 2023] ...zy/mason.nvim/lua/mason-core/installer/registry/util.lua:50: Failed to fetch versions for package P ackage(name=jdtls)
50 [ERROR Sun Oct 1 16:36:04 2023] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name= jdtls) error='spawn: wget failed with exit code 8 and signal 0. \nFailed to download file "https://download.eclipse.org/jdtls/milestone s/1.27.1/jdt-language-server-1.27.1-202309281329.tar.gz".'
Neovim version (>= 0.7)
NVIM v0.9.1 Build type: Release LuaJIT 2.1.0-beta3
Operating system/version
Linux zenbook 5.15.0-84-generic #93-Ubuntu SMP Tue Sep 5 17:16:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Healthcheck
mason: require("mason.health").check()
mason.nvim
- OK mason.nvim version v1.8.0
- OK PATH: prepend
- OK Providers:
mason.providers.registry-api
mason.providers.client
- OK neovim version >= 0.7.0
mason.nvim [Registries]
- OK Registry github.com/mason-org/mason-registry version: 2023-10-01-sulky-gong is installed.
mason.nvim [Core utils]
- OK unzip: UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
- OK wget: GNU Wget 1.21.4 built on linux-gnu.
- OK curl: curl 8.3.0 (x86_64-pc-linux-gnu) libcurl/8.3.0 OpenSSL/3.1.3 zlib/1.3 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.11.0 nghttp2/1.56.0
- OK gzip: gzip 1.13
- OK tar: tar (GNU tar) 1.35
- OK bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
- OK sh: Ok
mason.nvim [Languages]
- WARNING cargo: not available
- ADVICE:
- spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING Composer: not available
- ADVICE:
- spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
- ADVICE:
- spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
- ADVICE:
- spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Ruby: not available
- ADVICE:
- spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING RubyGem: not available
- ADVICE:
- spawn: gem failed with exit code - and signal -. gem is not executable
- OK Go: go version go1.21.1 linux/amd64
- WARNING julia: not available
- ADVICE:
- spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: Python 3.11.5
- OK node: v20.7.0
- OK java: openjdk version "17.0.8.1" 2023-08-24
- OK javac: javac 17.0.8.1
- OK pip: pip 23.2.1 from /usr/lib/python3.11/site-packages/pip (python 3.11)
- OK python venv: Ok
- OK npm: 10.1.0
mason.nvim [GitHub]
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Sun Oct 1 17:32:05 2023.
Install and authenticate via gh-cli to increase rate limit.
Screenshots
After 2 tiring days of trying to install, I temporarily fixed it with this method:
Open ~/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registry.json
Find jdtls and change source.id, jdtls.tar.gz
:MasonInstall jdtls
{
"name": "jdtls",
"description": "Java language server.",
"homepage": "https://github.com/eclipse/eclipse.jdt.ls",
"licenses": [
"EPL-2.0"
],
"languages": [
"Java"
],
"categories": [
"LSP"
],
"source": {
"id": "pkg:generic/eclipse/[email protected]",
"download": [
{
"target": [
"darwin_x64",
"darwin_arm64"
],
"files": {
"jdtls.tar.gz": "https://download.eclipse.org/jdtls/milestones/{{ version | strip_prefix \"v\" }}/jdt-language-server-{{ version | strip_prefix \"v\" }}-202309140221.tar.gz",
"lombok.jar": "https://projectlombok.org/downloads/lombok.jar"
},
"config": "config_mac/"
},
{
"target": "linux",
"files": {
"jdtls.tar.gz": "https://download.eclipse.org/jdtls/milestones/{{ version | strip_prefix \"v\" }}/jdt-language-server-{{ version | strip_prefix \"v\" }}-202309140221.tar.gz",
"lombok.jar": "https://projectlombok.org/downloads/lombok.jar"
},
"config": "config_linux/"
},
{
"target": "win",
"files": {
"jdtls.tar.gz": "https://download.eclipse.org/jdtls/milestones/{{ version | strip_prefix \"v\" }}/jdt-language-server-{{ version | strip_prefix \"v\" }}-202309140221.tar.gz",
"lombok.jar": "https://projectlombok.org/downloads/lombok.jar"
},
"config": "config_win/"
}
]
},
That's exactly what I did as well :-) Not the best user experience though^^
There is latest.txt for every version that contains the file name of the tarball if that helps.
https://download.eclipse.org/jdtls/milestones/1.23.0/latest.txt
launcher is also hard coded so it's about time this is causing issues.
jdtls/plugins/org.eclipse.equinox.launcher.jar: plugins/org.eclipse.equinox.launcher_1.6.500.v20230717-2134.jar
Open
~/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registy.json
There is a typo. Fixed path: ~/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registry.json.
There is
latest.txtfor every version that contains the file name of the tarball
Yeah, I also wonder why it is not utilized.
When trying to apply these changes, Mason is overwriting the changes to registry.json. Why is this; is anyone else having this issue?
I think right now the only good solution is to have a custom registry with the packages you want. Even adding local path requires some yaml parser. Even when I tried last week, it did not work. I started doing jdtls package versioning by mason packages just like in NixOS.
Ex:- https://github.com/nvim-java/mason-registry/blob/main/packages/jdtls-1.33.0/package.yaml
If you are willing to add the necessary package version, I'm willing to accept the PR.
Repeating my suggestion from https://github.com/mason-org/mason-registry/issues/3017#issuecomment-2089994950 here:
Following the purl specs I wonder if we could add the required timestamp a qualifier to the package id:
id: pkg:generic/eclipse/[email protected]?timestamp=202404031240
This should make it easy to reference it in the source.file.download section.
Alternatively we could append it to the version separated with a dash:
id: pkg:generic/eclipse/[email protected]
Then split it with an expression to create the final download URL.