You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Failed to run `config` for nvim-java ...zy/mason.nvim/lua/mason-core/package/AbstractPackage.lua:132: attempt to index local 'location' (a function value) # stacktrace: - mason.nvim\lua\mason-core\package\AbstractPackage.lua:132 _in_ **get_receipt** - mason.nvim\lua\mason-core\package\AbstractPackage.lua:168 _in_ **get_installed_version** - lua/config/lazy.lua:25 - init.lua:2
My config files:
vim.lsp.enable({ "jdtls" }) -- Error persists with or without this line
Hi, I'm also getting some errors which are triggered by the call to require('java').setup({}):
Error detected while processing /home/davy/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...zy/mason.nvim/lua/mason-core/package/AbstractPackage.lua:132: attempt to index local 'location' (a function value)
stack traceback:
...zy/mason.nvim/lua/mason-core/package/AbstractPackage.lua:132: in function 'get_receipt'
...zy/mason.nvim/lua/mason-core/package/AbstractPackage.lua:168: in function 'get_installed_version'
...local/share/nvim/lazy/nvim-java/lua/java/utils/mason.lua:18: in function 'is_available'
...local/share/nvim/lazy/nvim-java/lua/java/utils/mason.lua:49: in function 'is_outdated'
...share/nvim/lazy/nvim-java/lua/java/startup/mason-dep.lua:27: in function 'install'
/home/davy/.local/share/nvim/lazy/nvim-java/lua/java.lua:35: in function 'setup'
/home/davy/.config/nvim/init.lua:545: in main chunk
This is very likely related to Mason's breaking changes https://github.com/mason-org/mason-lspconfig.nvim/blob/main/CHANGELOG.md#200-2025-05-06 .
@s1n7ax Same here. Seems to be incompatible with mason 2.0.
Failed to run `config` for nvim-java
...zy/mason.nvim/lua/mason-core/package/AbstractPackage.lua:132: attempt to index local 'location' (a function value)
# stacktrace:
- /mason.nvim/lua/mason-core/package/AbstractPackage.lua:132 _in_ **get_receipt**
- /mason.nvim/lua/mason-core/package/AbstractPackage.lua:168 _in_ **get_installed_version**
- lua/base/utils/init.lua:318
I have another issue, but I don't know if it is related to this issue, this PR or nvim-java in general:
When I start Neovim, Mason opens and although it shows jdtls as installed, it tries to install it and repots the download error [4/4] Failed to download file "https://download.eclipse.org/jdtls/milestones/1.43.0/jdt-language-server-1.43.0-202504011455.tar.gz"
local jdk = mason_reg.get_package('openjdk-17')
if jdk:is_installed() then
local java_home = vim.fn.glob(path.join(jdk:get_install_path(), '/jdk-17*'))
local java_bin = path.join(java_home, '/bin')
base_config.cmd_env = {
['PATH'] = vim.fn.getenv('PATH') .. ':' .. java_bin,
['JAVA_HOME'] = java_home,
}
end
to
local jdk = mason_reg.get_package('openjdk-17')
if jdk:is_installed() then
local java_home = vim.fn.glob(vim.fn.expand("$MASON/packages/openjdk-17/jdk-17*"))
local java_bin = path.join(java_home, '/bin')
base_config.cmd_env = {
['PATH'] = vim.fn.getenv('PATH') .. ':' .. java_bin,
['JAVA_HOME'] = java_home,
}
end
nvim-java-core/lua/java-core/utils/mason.lua
local mason_registry = require('mason-registry')
local M = {}
---Returns the path to the package in mason packages
---@param pkg_name string
---@return string | nil
function M.get_pkg_path(pkg_name)
-- CHANGED: Replaced deprecated get_install_path() with manually constructed path
local mason_data_path = vim.fn.stdpath("data") .. "/mason/packages/" .. pkg_name
return mason_data_path
end
---Returns true if the package is installed in mason
---@param pkg_name string
---@return boolean
function M.is_pkg_installed(pkg_name)
-- CHANGED: Used pcall to safely check if package exists and avoid runtime errors
local ok, pkg = pcall(mason_registry.get_package, pkg_name)
return ok and pkg:is_installed()
end
---Returns the shared artifact path for a given package
---@param pkg_name string name of the package to get the path of
---@return string # path to the shared artifact directory of the package
function M.get_shared_path(pkg_name)
-- CHANGED: Replaced use of shell variable $MASON with Neovim's standard path function
local mason_share_path = vim.fn.stdpath("data") .. "/mason/share/" .. pkg_name
return mason_share_path
end
return M
this configuration will replace mason2.0.0 api than older mason braking api changes and it works well for me
@Kabil777 I've reviewed and it looks good to me. I've also looked into every other sub-project of nvim-java and I can't find any other change required.
https://download.eclipse.org/jdtls/milestones/1.43.0/jdt-language-server-1.43.0-202504011455.tar.gz the url verson number is not correct, it should be 1.46.1.
@JameChou If you keep backtracing, you see versions are hardcoded, and taken from the versions file here, unless the user override with his own config.
Your code works, but it seems it is not what the developer intended originally. Probably as a mean to avoid remote breaking changes.
It will download directly the 1.46.1 (bypassing the wrong 1.43.0 url).
But I cannot have the lombok support. The annotation @Data is not autocompleted and all the boilerplate methods are not recognized.
Even if it is installed in the Mason menu, when I open a .java file, the LSP jdtls says:
E The import lombok cannot be resolved Java (268435846) [3, 8]
E Data cannot be resolved to a type Java (16777218) [10, 5]
PS:
When I open a .java file, I have these warnings concerning the dap:
dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: infunction'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: infunction'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: infunction'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: infunction''
vim/_editor.lua: infunction<vim/_editor.lua:0>
Press ENTER or typecommand to continue
Error executing vim.schedule lua callback: ...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:28:
dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: infunction'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: infunction'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: infunction'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: infunction''
vim/_editor.lua: infunction<vim/_editor.lua:0>
stack traceback:
[C]: infunction'error'
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:28: infunction'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: infunction'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: infunction'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: infunction''
vim/_editor.lua: infunction<vim/_editor.lua:0>
Press ENTER or typecommand to continue
All of these errors are due to the recent migration to Mason 2.0.0.
Reacted by Zeioth, Eduardo Tinta, Alexis Visser and Devin F.
@Zeioth You're right. This was just a temporary fix, but now your PR has been merged into the main branch. Thanks for your suggestions and contributions.
i am using lazyvim and can't upgrade mason to 2.0 yet, so I set nvim-java to the latest version before the commit, howver i get this weird bug when I do lsp hover for a symbol i get "no information avaliable" message, even though it returns information. Anyone had this issue?
PS: When I open a .java file, I have these warnings concerning the dap:
dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
Error executing vim.schedule lua callback: ...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:28:
dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
[C]: in function 'error'
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:28: in function 'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
All of these errors are due to the recent migration to Mason 2.0.0.
Activity
yamafaktory commentedon May 7, 2025
Hi, I'm also getting some errors which are triggered by the call to
require('java').setup({}):This is very likely related to Mason's breaking changes https://github.com/mason-org/mason-lspconfig.nvim/blob/main/CHANGELOG.md#200-2025-05-06 .
mdudzinski commentedon May 7, 2025
I'm running into the same issue
Zeioth commentedon May 7, 2025
@s1n7ax Same here. Seems to be incompatible with mason 2.0.
Full mason v2 changelog:
https://github.com/mason-org/mason.nvim/blob/main/CHANGELOG.md
Zeioth commentedon May 7, 2025
PR shipped. It can be tested here:
#376
Kabil777 commentedon May 8, 2025
@Zeioth I've made the change locally, but I'm still encountering different error like
cmon1701 commentedon May 8, 2025
@Zeioth I can confirm that it works!!
I have another issue, but I don't know if it is related to this issue, this PR or nvim-java in general:
When I start Neovim, Mason opens and although it shows jdtls as installed, it tries to install it and repots the download error
[4/4] Failed to download file "https://download.eclipse.org/jdtls/milestones/1.43.0/jdt-language-server-1.43.0-202504011455.tar.gz"Kabil777 commentedon May 8, 2025
@Zeioth
Additionally I have changed 2 files to make it work and they were
nvim-java-core/lua/java-core/ls/servers/jdtls/init.lua
from this method
to
nvim-java-core/lua/java-core/utils/mason.lua
this configuration will replace mason2.0.0 api than older mason braking api changes and it works well for me
Zeioth commentedon May 8, 2025
@Kabil777 I've reviewed and it looks good to me. I've also looked into every other sub-project of nvim-java and I can't find any other change required.
Why not sending the PR to https://github.com/nvim-java/nvim-java-core ?
Kabil777 commentedon May 8, 2025
Here is my PR to nvim-java-core
I'm also looking for nvim-javagenie feature in nvim-java which provides feature of jpa-buddy plugin in intelij-idea
4r73m190r0s commentedon May 8, 2025
Can someone help how to tie
nvim-javawithlspconfigandmason.nvim?From the main page of GitHub
Here is my config:
I don't know where to call
require('java').setup()?JameChou commentedon May 9, 2025
@cmon1701 I got the same issue.
https://download.eclipse.org/jdtls/milestones/1.43.0/jdt-language-server-1.43.0-202504011455.tar.gzthe url verson number is not correct, it should be1.46.1.Check Mason 2.0 realease note.
get_latest_version()will return package lastest version.PR
change to
Zeioth commentedon May 10, 2025
@JameChou If you keep backtracing, you see versions are hardcoded, and taken from the versions file here, unless the user override with his own config.
Your code works, but it seems it is not what the developer intended originally. Probably as a mean to avoid remote breaking changes.
Morph01 commentedon May 10, 2025
Hello,
The jdtls 1.46.1 is now available thanks to @s1n7ax (nvim-java/release-jdtls#3).
A temporary solution is to specify the jdtls version:
It will download directly the 1.46.1 (bypassing the wrong 1.43.0 url).
But I cannot have the lombok support. The annotation
@Datais not autocompleted and all the boilerplate methods are not recognized.Even if it is installed in the Mason menu, when I open a .java file, the LSP jdtls says:
E The import lombok cannot be resolved Java (268435846) [3, 8] E Data cannot be resolved to a type Java (16777218) [10, 5]PS:
When I open a .java file, I have these warnings concerning the dap:
All of these errors are due to the recent migration to Mason 2.0.0.
JameChou commentedon May 11, 2025
@Zeioth You're right. This was just a temporary fix, but now your PR has been merged into the main branch. Thanks for your suggestions and contributions.
uuuulopta commentedon May 11, 2025
i am using lazyvim and can't upgrade mason to 2.0 yet, so I set nvim-java to the latest version before the commit, howver i get this weird bug when I do lsp hover for a symbol i get "no information avaliable" message, even though it returns information. Anyone had this issue?
Zeioth commentedon May 11, 2025
@uuuulopta you are likely missing mason-lspconfig.nvim v2
Kabil777 commentedon May 11, 2025
@Zeioth There is still an unresolved issue in
nvim-java/core: it is not yet compatible with Mason v2.0.0.MrMic commentedon May 12, 2025
When will this bug be fixed?
KR
s1n7ax commentedon May 13, 2025
mason-org/mason.nvim#1944
HakuFlaku commentedon May 14, 2025
@Morph01
Is #293 related to this at all?