Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork78
Troubleshooting
Solution
nvim-java is using specific versions for some packages such asjdtls 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-registryhere containing those packages.nvim-java passes that custom registry in the lazy configuration usinglazy.lua however, this might not be passed to therequire('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.
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}
return {'williamboman/mason.nvim',opts=function()-- do all your complex stuff herereturn {ui= {icons= {package_installed='✓',package_pending='➜',package_uninstalled='✗',},},}end,}
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,}
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.
In the project, remove,
.classpath.project
In cache, remove,
$HOME/.cache/jdtls$HOME/.cache/nvim/jdtls
Solution
- Go to the project and run
mvn eclipse:clean eclipse:eclipse
- Now open the project in Neovim
Readthis article for more information
Solution
If you are getting this error, that meansjdtls having a hard time finding the root of the project.This mostly happens when one of the parent directories is agit repository. If you are someone whomanages 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-javabut not pass.git
require('java').setup({root_markers= {'settings.gradle','settings.gradle.kts','pom.xml','build.gradle','mvnw','gradlew','build.gradle','build.gradle.kts' },})
- Make current folder a git repository
git init
- Re-open neovim
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,},})
Solution
We are installingjdk-17 because that's the recommended runtime to runjdtls. However, if you havejdk-17 already, you can use that instead. To disable auto install, setjdk.auto_install tofalse
require('java').setup({jdk= {auto_install=false, },})
Solution
This is not related tonvim-java but you can solve it by updatingmason.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.