-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot import maven project from workspace #2972
Cannot import maven project from workspace #2972
Comments
@iamfreeman could you provide a project example reproducing the issue? |
I cannot. I have multiple projects on my workstation and this is the only one I got such error. I tried Intellij to open the project and it works. So I assume it should be some index related issue. The only way to fix it is to delete the entire folder and delete repo and then redownload everything from git. After that, it works. And it still have chance to stuck on this "31% Refreshing '/jdt.ls-java-project'" anytime I cleanup the workspace. Things I have tried:
Here are the trace log for my language server:
Then it never receive notification from server anymore |
@iamfreeman could you try to set
|
This is my settings:
it does not work Actually this issue happened on my colleague workstation as well. |
@iamfreeman Could you show your server log ? |
Here you are. It is 14:10 here. Server log have enties til 13:26
|
@iamfreeman could you check yor workspace settings. You have set
|
My User settings:
My workspace settings:
|
after 1 hour of hanging, I got the following error as well:
|
@iamfreeman could you add
to your workspace settings |
Added. Nothing changed |
@iamfreeman Could you add
to your workspace settings and show your new log? |
@iamfreeman What maven plugins are you using? Could you show your pom.xml? |
Here you are |
I can't reproduce the issue. Please try #2972 (comment) |
No much difference to me |
@iamfreeman Could you, please, add
to your workspace settings and show your new log? |
Sorry, my apology. I have add the setting to my workspace log:
|
@iamfreeman could you try
Added: |
|
|
After I remove the java home arg,
For other projects, it looks fine to me log from another project:
|
@iamfreeman Could you try to add
to your workspace settings. |
@iamfreeman How long does your build take from the command line? |
|
around 40s |
@snjeza , btw, last night I left the VScode window open for the whole night, here is the log:
You can see this in the output
However, it does not mean my VScode windows is ready to use, Intellisense still does not work, and warning/error messages does not show up at all. |
@snjeza , any luck? |
@iamfreeman I can't reproduce the issue. Could you, please, check VS Code
|
I've been having what appears to be exactly this problem. Anecdotally I noticed The other symptoms which make me think it might be the same issue we see here is the output in the first comment:
And then a timeout. And the same / similar messaging in the Java Build Status output. @iamfreeman how have you gotten on in the past few months? Might this be similar to your situation? (ie. lots of files in the project) Is there a way to ignore folders, e.g. I have tried adding to my "java.project.resourceFilters": [
"node_modules",
"\\.git"
] However that doesn't appear to have changed the behaviour... it still hangs / takes forever to load the Java project. Whereas if I delete the This is the stack I saw when things appeared to be hung / taking a long time:
|
@karlvr Could you show your settings.json?
You can set
|
@snjeza thank you, I have just tried adding that and cleaning the Java Language Server Workspace, but it doesn't appear to have changed the behaviour; still slow (~3 minutes so far and no change) in the Java Build Status:
This is the current contents of my {
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": true
},
"java.configuration.updateBuildConfiguration": "automatic",
"java.checkstyle.configuration": "${workspaceFolder}/checkstyle.xml",
"java.checkstyle.version": "8.41",
"java.codeGeneration.hashCodeEquals.useJava7Objects": true,
"java.project.resourceFilters": [
"node_modules",
"\\.git"
],
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
],
} PS. I edited my previous post to add a little more detail and a stack trace. |
@snjeza curiously... I had a setting in my user Anyway, I removed that from my user "java.import.generatesMetadataFilesAtProjectRoot": true, And now I see And now the project builds like lightning. Lightning. I have confirmed on a second machine (which curiously didn't have any setting that appears connected to I am now testing without the resource filters and exclusions. It is feeling like those weren't applied until I had the |
It works properly.
It shouldn't be related to the .project file. |
@snjeza The file exclusion settings don't seem to make much difference (maybe a little, it's a bit hard to tell), but adding that I've tested the time taken to stop spinning the Java building spinner from a Clean Java Language Server Workspace, and I haven't yet measured a difference with or without the filtering entries in With the Do we understand why this is happening? Curiously, with or without the file exclusions in <filteredResources>
<filter>
<id>1701910502291</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources> |
@karlvr Could you attach your project? |
@snjeza good news! I've managed to reduce my project down to a very small example and I've depersonalised it to the point that I think I can share it! Firstly, this project should load and build speedily and AOK. Then to break it, at least on my machine (MacBook Pro M1, Sonoma): cd srv/main/frontend
nvm use # or use node 18
npm -g install pnpm # If you don't already have pnpm 8 installed
pnpm install That creates Then clean JLS workspace and for me it takes forever. |
I have reproduced the issue. I'm trying to fix it. |
@karlvr |
@karlvr Could you try to test VS Code 1.27.3? |
@snjeza thank you very much, I have installed the
Notes on method:
Conclusion: You've fixed it and I'm very happy. It seems there's a slight advantage for the "java.project.resourceFilters": [
"node_modules",
"\\.git"
],
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
],
"java.import.generatesMetadataFilesAtProjectRoot": true, I converted from Eclipse a few years ago and my life has been so much better, and now it's better again. Thank you, and everyone, for your efforts. |
I did experience an issue where the Lombok JAR could not be found with v1.27.3, but maybe that's just a weird feature of the test build? Or another sympathetic extension upgrade that's required? From
|
VS Code 1.27.3 doesn't include lombok. jar. It will be included in release/pre-release.
See also eclipse-jdtls/eclipse.jdt.ls#2985 |
Everytime I clean up workspace by hitting "F1" and select "Java: Clean Language Server Workspace", redhat stuck on importing Java maven project
Environment
On the build status console:
Client log:
Running extension:
Even I manually delete workspace folders, issue will not be solved.
Current Result
Maven project cannot be imported into VScode, it stuck in 31% forever. The only way to solve it is to remove the entire repository and download it again. And it only works for 1 time. If I clean the workspace again, it will stuck at import maven project again.
Expected Result
Import successfully
The text was updated successfully, but these errors were encountered: