nvim-jdtls icon indicating copy to clipboard operation
nvim-jdtls copied to clipboard

Maven project structure not recognized

Open andrwui opened this issue 1 year ago • 0 comments

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

andrwui avatar Oct 08 '24 16:10 andrwui