Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

jdtls fails to start after clearing ~/.m2/repository

Open
#429 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
emacs-lisp, java
Domain
tooling

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from emacs-lsp/lsp-java

All issues in emacs-lsp/lsp-java

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.