microsoft / vscode-java-dependency

Manage Java projects in Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency
MIT License
152 stars 74 forks source link

Maven multi-module project doesn't correctly open modules #766

Closed vitalyla closed 12 months ago

vitalyla commented 1 year ago

Hi there,

Since recent update to new version of an extension, the incorrect behavior was noticed when importing multi-module Maven project. When importing the "parent" project, the child modules are not getting resolved as Java projects in "Java Projects" pane. Also, when selecting the "pom.xml" file shown under any of the child "module", the parent's "pom.xml" is opened instead in the editor. The "explorer" view shows the structure correctly.

The POM structure of both "parent" and child modules, was re-checked several times and the same works well in other editors. When importing child modules alone, one by one or both together, they open as expected. The problem is noted only when importing "parent" POM with "modules" inside it.

Environment: Project Manager for Java version: v0.22.0 VS Code version: v1.78.2

java-projects-pane-multimodules

jdneo commented 1 year ago

Could you provide a sample project and reproduce steps?

vitalyla commented 1 year ago

Sure. Please find attached the multi-module project that has that issue. Also below is the snapshot how it looks like in VS Code when tried to be loaded.

mvn-multimodule-test.tar.gz

image
jdneo commented 1 year ago

image

Is that because of the typo? endpoints not endpionts

charleech commented 1 year ago

I used to face this issue once with the following environment.

OS: Windows 11 Home Single Language 22H2 VS Code version 1.78.2 Extension Pack for Java version 0.25.11 Project Manager for Java version 0.22.0

I have tried to Refresh, Clean Workspace , close the VSCode and re-open many times but nothing help. The Java Project View still display only some maven modules and some of them were not be displayed.

Then I start from scratch by opening the empty VSCode, then choosing File --> Add Folder to Workspace...

At this time the Java Project View is able to display all my maven module properly.

IMHO, there may be something in the mist with File --> Open Folder that block the Java Project View so that it is not able to list all maven sub module in the project hierarchy.

vitalyla commented 1 year ago

@jdneo I apologizes, noticed the typo late. Attached is the corrected version. However, same behavior once typo is fixed. The same project opens correctly in Eclipse IDE though.

@charleech Thank you for suggested steps, I tried those, but no success.

One more observation, is when I create similar hierarchy "from scratch", using Maven archetypes or manually, and importing it using the same steps as problematic project, the former ones opens correctly, without any issues.

An attached archive is similar to the real project, and was copy-pasted as is just with replacement of Java files and artifact names in the POM. The structure is the same.

mvn-multimodule-test.tar.gz

jdneo commented 1 year ago

Thank you for the update. I can reproduce this issue on my side. I will debug into the extension to see what happens later.

rossinineto commented 1 year ago

With update 0.23 this problem still persists, when you have a workspace with two or more java project folders added and these projects has a parent project.

Downgraded to 0.21.2 to solve the problem.

vitalyla commented 1 year ago

Hi,

Any update/progress on the issue? It makes it very problematic to work with multimode projects.

rossinineto commented 1 year ago

The problem still happens!

vitalyla commented 1 year ago

Hi @jdneo,

did you have a chance to work on the problem? It is really impossible to work with true multi-maven project with VSCode and requires to find different workarounds.

jdneo commented 1 year ago

Sorry for the late reply. I looked into it today and find the root cause is the same as https://github.com/microsoft/vscode-java-dependency/issues/788.

I can confirm that after applying the change proposed by @fvclaus. The issue is addressed for the attached project.

I'll ask @fvclaus if he is willing to raise a PR for that since he is the one finds out the root cause.

vitalyla commented 1 year ago

Thanks, @jdneo!

I checked the description of linked issue and it seems indeed the problem. Looking forward when it is going to be part of the next VSCode update.

jdneo commented 1 year ago

I will keep an eye on this and try to make at least a pre-release for the fix.

vitalyla commented 1 year ago

Hi @jdneo,

With a recent update of VSCode it seems like some issues were resolved, at least I can load some modules but with only one level depth. When hierarchy goes to 3 levels then behaviour is the same as outlined in this issue and the linked ones. I understand that referred items are still open and it would be great if tests will cover different depth levels of projects with some reasonable number 5-10.

jdneo commented 1 year ago

The solution provided in #791 should handle those cases. It's working in progress now please stay in tune.

jdneo commented 12 months ago

Sorry it's a little bit late since the issue is reported. I just kicked off a pre-release 0.23.2023100802 containing the fix. Users should receive the update notification after couple hours.