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
nvim-java is using specific versions for some packages such as jdtls that's different from the main Mason.nvim registry. Reason for that is to avoid breakage due to package update. For this, nvim-java has a custom mason-registry here containing those packages. nvim-java passes that custom registry in the lazy configuration using lazy.lua however, this might not be passed to the require('mason').setup() function if you skips passing the default options.
So, this issue probably occurs due to the way you have configured Mason.nvim. Follow the instructions below to correctly configure Mason.nvim using Lazy.nvim.
Method 1: use opts instead of config function to setup mason
return {
'williamboman/mason.nvim',
opts= {
ui= {
icons= {
package_installed='✓',
package_pending='➜',
package_uninstalled='✗',
},
},
},
-- use OPTS property to pass the configuration-- lazy vim call the setup function for you-- config = function()-- require('mason').setup({})-- end-- ^^^^^^^^^^^^^^^^ DON'T DO THIS
}
Method 2: If you have complex configuration inside config, you can pass a function to opts
return {
'williamboman/mason.nvim',
opts=function()
-- do all your complex stuff herereturn {
ui= {
icons= {
package_installed='✓',
package_pending='➜',
package_uninstalled='✗',
},
},
}
end,
}
Method 3: If you really want to use config property for some reason, consider the default values
return {
'williamboman/mason.nvim',
config=function(_, opts)
localconf=vim.tbl_deep_extend('keep', opts, {
ui= {
icons= {
package_installed='✓',
package_pending='➜',
package_uninstalled='✗',
},
},
})
-- ^^^^^ Here we are basically merge you configuration with OPTS-- OPTS contains configurations defined elsewhere like nvim-javarequire('mason').setup(conf)
end,
}
⛔ How to clean rebuild
Solution
Unfortunately, we don't have command to auto update the classpath when you change dependencies, or jdk. Without force rebuild, changes will not be applied. So for now, you can manually remove following files.
⛔ To enrich the config, XXX should already be present
Solution
If you are getting this error, that means jdtls having a hard time finding the root of the project.
This mostly happens when one of the parent directories is a git repository. If you are someone who
manages the dotfiles in the $HOME directory using a git repository, you might see this error.
As a solution, you can make the current project root a git repository by running git init
Another option would be to pass the root markers when setting up nvim-java but not pass .git
⛔ How to remove noisy and annoying jdtls notifications
Solution
If you find following notifications annoying, first of all, this has nothing to do with this plugin,
BUT you can simply remove them when you are setting up the language server.
Here is how you can do it.
require("lspconfig").jdtls.setup({
handlers= {
-- By assigning an empty function, you can remove the notifications-- printed to the cmd
["$/progress"] =function(_, result, ctx) end,
},
})
⛔ Disable OpenJDK-17 auto installation
Solution
We are installing jdk-17 because that's the recommended runtime to run jdtls. However, if you have jdk-17 already, you can use that instead. To disable auto install, set jdk.auto_install to false
This is not related to nvim-java but you can solve it by updating mason.nvim plugin.
Case of this error is, mason-registry recently added packages from openvsx registry. However, old mason.nvim plugin does not know how to process this registry type.