jdtls fails to start after clearing ~/.m2/repository
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the failure through lsp-java while following the jdtls stderr output and the described Maven-project sequence. Trace how lsp-java imports the project and supplies cached Maven paths to jdtls; done means the second project starts without referencing the deleted Lombok JAR.
Written by the indexing model from the issue text.
Description
Describe the bug
After deleting my ~/.m2/repository, jdtls no longer starts. It is looking for a jar in my m2 which no longer exists. The jar is not used in the project that I am working on, but was used in one that I used in the past.
Related discussion: https://emacs.stackexchange.com/questions/76826/jdtls-failing-to-start-for-lsp-java-after-clearing-m2-repository
Note
This is a caching issue, so a clean config will not have the problem.
To Reproduce
Create a maven project that uses org/projectlombok/lombok/1.18.22/lombok-1.18.22
Edit a Java file in that project.
Create a maven project that does not use that version of Lombok.
Edit a Java file in that project.
Delete ~/.m2/repository
In the second project, run mvn install so that all dependencies for that project are downloaded.
Open emacs and edit a file in the second project.
Start lsp-java if not set up to do that automatically.
Select i or . when asked to import the project.
You will get a message that jdtls exited, asking if you want to restart it. Restarting will give you the same error message.
The jdtls::stderr buffer will contain many instances of
Process jdtls stderr finished
Error opening zip file or JAR manifest missing : /Users/me/.m2/repository/org/projectlombok/lombok/1.18.22/lombok-1.18.22.jar
Expected behavior
jdtls starts without errors and lsp-java works.
Screenshots
N/A
Logs
Please include the debug stack trace (if there is an error) and the content of Messages buffer with lsp-print-io set to t in case the bug is related to client->server communication.
End of messages (sanitized):
[2023-04-17 11:02:04.377] Set up lsp for /Users/me/projects/some-project/src/main/java/com/example/Example.java
[2023-04-17 11:02:04.400] my-java-mode-hook completed
[2023-04-17 11:02:04.659] using config for config_mac
[2023-04-17 11:02:05.015] LSP :: Connected to [jdtls:8457/starting /Users/me/projects/some-project].
[2023-04-17 11:02:06.471] LSP :: jdtls has exited (exited abnormally with code 1)
[2023-04-17 11:02:08.700] Server jdtls:8457/starting exited (check corresponding stderr buffer for details). Do you want to restart it? (y or n) y
[2023-04-17 11:02:08.736] using config for config_mac
[2023-04-17 11:02:09.113] LSP :: Connected to [jdtls:8578/starting /Users/me/projects/some-project].
[2023-04-17 11:02:09.962] LSP :: jdtls has exited (exited abnormally with code 1)
[2023-04-17 11:02:11.900] Server jdtls:8578/starting exited (check corresponding stderr buffer for details). Do you want to restart it? (y or n) n
lsp-log
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for /Users/me/projects/some-project/src/main/java/com/example/Example.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for /Users/tda0106/projects/some-project/src/main/java/com/example/Example.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
jdtls::stderr
Error opening zip file or JAR manifest missing : /Users/me/.m2/repository/org/projectlombok/lombok/1.18.22/lombok-1.18.22.jar
Error opening zip file or JAR manifest missing : /Users/me/.m2/repository/org/projectlombok/lombok/1.18.22/lombok-1.18.22.jar
Process jdtls stderr finished
This repeats many times.
- Dominant language
- Emacs Lisp
- Stars
- 696
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from emacs-lsp/lsp-java
-
dap-java discards module paths from resolveClasspath causing JPMS-modular projects fail to launchOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in emacs-lsp/lsp-java
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
detectors enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
SM260845/readme-gen#1 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ehmpathy/rhachet-roles-bhuild#407 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
codymikol/multiverse.nvim#330 ·
Maintainers usually reply within 8 days
-
bug cli dx
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
videojs/v10#3001 · 1 comment ·
Maintainers usually reply within 1 day