vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

VSCode reloads Java projects on each startup which takes a very long time

Open xxc-zsz opened this issue 2 years ago • 3 comments

I am in the process of switching from Eclipse to VSCode for Java Development - so far, I have been able to setup a workspace folder with all my Java projects in it and all works fine.

However, every time I restart VSCode, all projects are rebuilding (showing me "Opening Java Projects: check details") which takes a very long time (about 5 minutes) - in comparision, when I am re-opening my Eclipse workspace with the same amount of projects, it only takes ~30 seconds for everything to be ready. Is there something I am doing wrong or can't VSCode "remember" Java projects as good as Eclipse?

xxc-zsz avatar Aug 23 '22 08:08 xxc-zsz

@xxc-zsz What OS are you using? Do you use maven, gradle?

snjeza avatar Aug 23 '22 20:08 snjeza

Hi @snjeza I had a similar problem, but my situation was that the build stalled. This issue affects other features of VSCode (such as Source Control) If I disable "Language Support for Java(TM)" extension, source control works fine. This problem had begun in the last few days

Maven project VSCode: v1.70.2 Language Support for Java(TM): v1.9.0

THWU avatar Aug 24 '22 03:08 THWU

Hi @snjeza I had a similar problem, but my situation was that the build stalled. This issue affects other features of VSCode (such as Source Control) If I disable "Language Support for Java(TM)" extension, source control works fine. This problem had begun in the last few days

Maven project VSCode: v1.70.2 Language Support for Java(TM): v1.9.0

I found https://github.com/redhat-developer/vscode-java/issues/2577#issuecomment-1208922149 can solve my problem. Sorry, i miss this issue.

THWU avatar Aug 24 '22 04:08 THWU

@xxc-zsz Did you still observe the problem with the latest pre-release? There are several fixes regarding perf done recently.

You can click this button to turn on the pre-release channel image

jdneo avatar Oct 25 '22 08:10 jdneo

I have same problem here... I run vscode server in docker container. It took more than 5 minutes for loading java project...

System used: Host: ubuntu 22.04 Docker Image: ubuntu 20.04 VSCode: 1.74.1 Language Support For Java: 1.13.0 Java on Docker: OpenJDK 11.0.17

youngky-h avatar Jan 02 '23 04:01 youngky-h

I am experiencing the same problem running in a devcontainer. The project does not even contain much Java, it is mostly used to build things with maven.

Host: MacOs (aarch64) Docker image (devcontainer): bullseye VS Code: 1.74.2 Language Support For Java: 1.13.0 openjdk version "17.0.5" 2022-10-18 LTS

My initial thought was, that file I/O on docker on macOs is not the fastest. This can be improved by making the used folder a volume. Can someone tell me, what folder this extension puts its index in (assuming the indexing of the project is the slow part)?

I tried the pre-release version, did not noticeably differ wrt this issue. The task seems stuck on one item when reading the saved build state. Once that is done, it finishes almost instantly.

14c87596 Repository registry initialization [Done]
8dfb9fde Importing Maven project(s) [Done]
00df47a1 Synchronizing projects [Done]
3c3fe080 Synchronizing projects [Done]
25a05498 Background task: 50% Reading saved build state for project XXX [495/1000]

benjaminbauer avatar Jan 03 '23 08:01 benjaminbauer

I'm facing the same problem and switched back to eclipse. Any update on this issue?

tarekahf avatar Apr 02 '23 09:04 tarekahf

In eclipse, it take less than a minute to load several huge java projects and you are ready to run the tests. But, in vscode, you have to wait until you see the thumbs up icon in the status bar, which can take between 2 to 5 minutes for one maven project with 5 relatively large modules. During the loading process, nothing works like intelisens, running tests... etc.. You have to sit and wait...

tarekahf avatar Apr 27 '23 14:04 tarekahf

@GourabIX @tarekahf Could you, please, provide a project example?

snjeza avatar Apr 27 '23 17:04 snjeza

I am facing the same problem, any update regarding this issue?

jcgaming-official avatar May 07 '23 13:05 jcgaming-official

@jcgaming-official You can try to set

"java.jdt.ls.vmargs": "-Daether.dependencyCollector.impl1=df <your VM args",

to your settings.json. Could you provide a project example?

snjeza avatar May 07 '23 17:05 snjeza

Try this project to reproduce the issue:

https://github.com/javalite/jar-explorer

Everytime you open the project, open a Java source file and watch how the code is being compiled. This is a small project so compilation might finish quickly. But, it will always compile and you can click on view details to see the progress in the terminal window.

Let me if you need more information...

tarekahf avatar May 07 '23 19:05 tarekahf

facing the same issue, at first vs code opened projects very fast like 1 or 2 mins, don't know what happened after updating in oct/ nov in 2023, every time i open java project in vscode, it is taking like 20 mins to load all the projects.

rajmetti avatar May 23 '23 06:05 rajmetti

facing the same issue, at first vs code opened projects very fast like 1 or 2 mins, don't know what happened after updating in oct/ nov in 2023, every time i open java project in vscode, it is taking like 20 mins to load all the projects.

You mean Oct/Nov 2022?

tarekahf avatar May 23 '23 16:05 tarekahf

my bad, yes that is 2022

rajmetti avatar May 24 '23 04:05 rajmetti

I am still facing this issue on Oct / Nov 2023 on Fedora. My Java spring boot projects are cleaned on startup causing protobuf generated sources to be not present in maven submodule, which then shows redlines all over the place on other submodules which depend on it.

overtomanu avatar Nov 01 '23 15:11 overtomanu

I'm always facing the same problem. It takes about 7 minutes to load and run the unit test in VS code. In eclipse, for the same project, it takes 40 seconds.

tarekahf avatar Nov 01 '23 18:11 tarekahf

@overtomanu @tarekahf Could you, please, provide a project example?

snjeza avatar Nov 01 '23 19:11 snjeza

@overtomanu @tarekahf Could you, please, provide a project example?

I already provided one, see my previous post above. I'll try to make a screen recording for both.

tarekahf avatar Nov 01 '23 20:11 tarekahf

@snjeza I have opened around 8 to 10 work related projects. These projects are spring boot projects with some of them having proto files, nothing out of the ordinary. I will try to get sample project's to reproduce this issue when i get time.

overtomanu avatar Nov 02 '23 03:11 overtomanu

I also have problems here please improve this it takes 35 min each time to load the project, and I need to use lightweight mode but then I cannot debug it's so annoying @jdneo I use the pre-release version

Alirez14 avatar Apr 11 '24 07:04 Alirez14

I also have problems here please improve this it takes 35 min each time to load the project, and I need to use lightweight mode but then I cannot debug it's so annoying @jdneo I use the pre-release version

I found a solution and it us the best. To fix this issue, just switch your OS into Linux. Yes I am using that now and it's open smoothly

jcgaming-official avatar Apr 11 '24 07:04 jcgaming-official

I'm facing the same problem. I have about 70 java projects and it's taking more than 35 minutes. Not sure why it has to reload everything. It should just be reloading the deltas.

cervantesandres avatar May 20 '24 19:05 cervantesandres

@cervantesandres Could you try VS Code Pre-Release? It includes the fix for https://github.com/redhat-developer/vscode-java/issues/3637

snjeza avatar May 20 '24 20:05 snjeza

@snjeza Could you clarify what you're referring to by "VS Code Pre-Release"?

cervantesandres avatar May 20 '24 23:05 cervantesandres

Select the pre-release vscode-java version

Screenshot 2024-05-21 at 01 44 18

fbricon avatar May 20 '24 23:05 fbricon

@fbricon @snjeza Switching to Pre-Release didn't resolve the issue; Java building still takes around 35 minutes. Seems like every class is getting compiled when the plugin opens

image

cervantesandres avatar May 21 '24 17:05 cervantesandres

@cervantesandres Could you try the steps from https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150#issue-2279821730? Step 6 (building) is the same, but step 7 (reloading) has improved significantly.

snjeza avatar May 21 '24 17:05 snjeza

@snjeza to clarify, you want me to try these 7 steps? image

cervantesandres avatar May 21 '24 17:05 cervantesandres

to clarify, you want me to try these 7 steps?

Yes. You should use your project instead of quarkus-langchain4j

snjeza avatar May 21 '24 18:05 snjeza