mfussenegger / nvim-jdtls

Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
GNU General Public License v3.0
1.14k stars 62 forks source link

Maven project structure not recognized #702

Open andrwui opened 1 month ago

andrwui commented 1 month ago

LSP client configuration

local java = { 'mfussenegger/nvim-jdtls', config = function() local jdtls = require('jdtls')

local config = {
  cmd = { vim.fn.stdpath('data') .. '/mason/bin/jdtls' },
  root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]),
  settings = {
    java = {
      jdkHome = '/usr/local/jdk-8/bin',
      project = {
        sourcePaths = { "src/main/java" },
      }
    }
  },
}

jdtls.start_or_attach(config)

end }

return { java }

Eclipse.jdt.ls version

latest, i can't find it

Steps to Reproduce

In a project using Maven, with a file structure of classes being in src/main/java, open a file in any package

Expected Result

The laguange server recognizes correctly the package the current class is in, and imports can be resolved

Actual Result

The language server won't recongnize the package the current class is in, also doesn't recongizes any imports eg: The declared package 'com.util' does not match the expected package 'main.java.com.util

alex-k03 commented 3 weeks ago

Did you find a solution to this?