vscode-java: Multi-module Maven project does not work

I created a multi-module Maven project and tried to open the root folder in Visual Studio Code. When I try to work with any of the sub-modules, I do not get any linting, formatting, refactoring, etc… I tried Add Folder to Java Source Path but that does not work either. I have no issues working with this project in other IDE’s, including Eclipse.

Environment
  • Operating System: Windows 10
  • JDK version: 1.8.0.201
  • Visual Studio Code version: 1.14.1
  • Java extension version: 0.55.1
Steps To Reproduce
  1. Clone example project:
git clone https://github.com/hashdelta/stix-pattern-evaluator-examples.git
cd stix-pattern-evaluator-examples
git checkout develop
  1. Open project in VSCode
Current Result

The plugin does not recognize the children modules, thus does not provide any kind of Java semantics support - no linting, formatting, refactoring, etc…

Expected Result

You should be able to get semantics support for any Java class when you open the parent. It should be one cohesive project.

Additional Informations

The only way to work with the sub modules is by opening the module in its own VSCode instance. This does not work for me, as one of my projects consists of over 20+ modules.

I have verified in Eclipse, NetBeans, and IntelliJ that the GitHub project has no issues.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 10
  • Comments: 18 (5 by maintainers)

Most upvoted comments

It looks like clearing the workspaceStorage fixed my issue. Does this deserve a close?

@hashdelta yes, you can close the issue.

Hi, I am just facing same issue, kindof no idea how to make vs code recognize the project folder and all sub folders and files as a multi-module maven project, e.g. pom file in sub module report error “could not find dependency” What steps shall I take to make project workable in vs code until I can debug the source file

@snjeza Thank you! I didn’t know how to set the logs to debug nor read them. Through the logs I found out that all of my .project files from Eclipse all had <!DOCTYPE xml> on the 2nd line and that was causing it grief. No idea how they got there (well probably auto-added by Eclipse) but I removed those lines, reloaded the Java extension and voila it works!!! Thank you!