Skip to content
Junfeng Li edited this page Apr 20, 2018 · 9 revisions
  1. Install Eclipse JDT Language Server
  2. Create executable jdtls in path, with content:
java \
    -Declipse.application=org.eclipse.jdt.ls.core.id1 \
    -Dosgi.bundles.defaultStartLevel=4 \
    -Declipse.product=org.eclipse.jdt.ls.core.product \
    -noverify \
    -Xms1G \
    -jar {{ your java lsp installation }}/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_1.5.0.v20180207-1446.jar \
    -configuration {{ your java lsp installation }}/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/config_linux/ \
    "$@"
  1. Add to your vim config:
let g:LanguageClient_serverCommands = {
    \ 'java': ['jdtls', '-data', getcwd(), '-Dlog.level=ALL'],
    \ }

Before starting the lsp, your cwd should be set to the directory of your pom, not the file you are editing.

From author. Ideally this should be not be needed. LanguageClient-neovim should be able to automatically find the folder containing pom.xml and use it as project root. If this is not the case, please file bug.

This sets the cwd to the directory of the in your window:

nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
Clone this wiki locally