neoclide / coc-java

Java extension for coc.nvim
Eclipse Public License 1.0
449 stars 40 forks source link

"Classpath-is-incomplete" when open maven multi-module projects #13

Open sluongng opened 5 years ago

sluongng commented 5 years ago

I get "Classpath-is-incomplete" error when i try to open a file inside a multi-module maven project.

The layout of the project is similar to this: image (source image: https://www.mkyong.com/maven/maven-how-to-create-a-multi-module-project/)

Please advise on what is the correct way to setup for this.

Thanks

chemzqm commented 5 years ago

It's not supported yet, and I don't know how to make jdt.ls support it.

sluongng commented 5 years ago

It's not supported yet, and I don't know how to make jdt.ls support it.

https://github.com/autozimu/LanguageClient-neovim/issues/343 I think this one said it does support it though, is there a way to config coc-java to work like this out-of-the-box?

chemzqm commented 5 years ago

I'm improved the root logic on master of coc.nvim, you have to build from source code and start your vim at the root directory of your project.

sluongng commented 5 years ago

I'm improved the root logic on master of coc.nvim, you have to build from source code and start your vim at the root directory of your project.

Could you please do this via a PullRequest and link the PR to this issue? I would like to learn how to improve coc-java by learning from the PR.

chemzqm commented 5 years ago

https://github.com/neoclide/coc.nvim/commit/2e0a71e2353778a12cb5461f4f0f6ff6619fd8c3

It's just check if cwd could be used for project root, coc-java use workspace.findRoot

yashLadha commented 4 years ago

Hey I am still not able to load completion for the multi-maven project (findRoot is pointing to my project root). I am using this project link @chemzqm . Can you assist me in setting up the config.

Current config:

{
  "python.jediEnabled": false,
  "solargraph.completion": true,
  "java.import.gradle.wrapper.enabled": true,
  "java.maven.downloadSources": true,
  "java.import.gradle.enabled": true,
  "java.import.maven.enabled": true,
  "languageserver": {
    "dart": {
      "command": "dart",
      "args": [
        "/usr/local/opt/dart/libexec/bin/snapshots/analysis_server.dart.snapshot",
        "--lsp"
      ],
      "filetypes": ["dart"],
      "disableDynamicRegister": true,
      "trace.server": "verbose"
    },
    "golang": {
      "command": "gopls",
      "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
      "filetypes": ["go"],
      "initializationOptions": {
        "usePlaceholders": true
      }
    },
    "python": {
      "command": "python",
      "args": ["-mpyls", "-vv", "--log-file", "/tmp/lsp_python.log"],
      "trace.server": "verbose",
      "filetypes": ["python"],
      "settings": {
        "pyls": {
          "enable": true,
          "trace": {
            "server": "verbose"
          },
          "commandPath": "",
          "configurationSources": ["pycodestyle"],
          "plugins": {
            "jedi_completion": {
              "enabled": true
            },
            "jedi_hover": {
              "enabled": true
            },
            "jedi_references": {
              "enabled": true
            },
            "jedi_signature_help": {
              "enabled": true
            },
            "jedi_symbols": {
              "enabled": true,
              "all_scopes": true
            },
            "mccabe": {
              "enabled": true,
              "threshold": 15
            },
            "preload": {
              "enabled": true
            },
            "pycodestyle": {
              "enabled": true
            },
            "pydocstyle": {
              "enabled": false,
              "match": "(?!test_).*\\.py",
              "matchDir": "[^\\.].*"
            },
            "pyflakes": {
              "enabled": true
            },
            "rope_completion": {
              "enabled": true
            },
            "yapf": {
              "enabled": true
            }
          }
        }
      }
    }
  }
}
chemzqm commented 4 years ago

@yashLadha I don't have time to, you can checkout output https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

yashLadha commented 4 years ago

It is saying: Path must include project and resource name:

arbor-bdoyle commented 4 years ago

I ran into this today and after quite a lot of debugging it turns out I had a stray <directory>../target</directory> in the build section of one of the modules from a previous workaround. This convinces JDT that you're building outside of the project, even though it is still actually within the parent. Removing it broke the thing I was working around again, but allowed me to use this plugin. Seems like a fair trade.

Not sure this is your issue, but leaving it here in case anyone stumbles across this issue in the future hunting the same message.