question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode fails to load pom packaged parent of a multi-module maven project

See original GitHub issue

Even a simple multi-module maven project where the top level pom has <packaging>pom</packaging> will fail with the pom packaged project not being loaded and then the language server failing with the following:

[Error - 2:23:52 PM] Jan 22, 2021, 2:23:52 PM Problem load project library 
maven-multi-example does not exist
Java Model Exception: Java Model Status [maven-multi-example does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:573)
	at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(JavaModelManager.java:2525)
	at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(JavaProject.java:2382)
	at org.eclipse.jdt.internal.core.JavaProject.getRawClasspath(JavaProject.java:2411)
	at com.microsoft.jdtls.ext.core.PackageCommand.getContainers(PackageCommand.java:258)
	at com.microsoft.jdtls.ext.core.PackageCommand.getChildren(PackageCommand.java:107)
	at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:31)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$3(JDTLanguageServer.java:497)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Environment
  • Operating System: MacOS Big Sur
  • JDK version: 15.0.1
  • Visual Studio Code version: 1.52.1
  • Java extension version: v0.74.0
Steps To Reproduce
  1. Clone this example project: https://github.com/chadlyon/maven-multi-example.git
  2. code maven-multi-example
Current Result
Expected Result
Additional Informations

Changing to jar packaging produces the expected behavior in VSCode but results in a maven error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
jdneocommented, Jan 29, 2021

Fixed in downstream

0reactions
arjenzhoucommented, Jul 19, 2021

I have similar issue at https://github.com/redhat-developer/vscode-java/issues/2028#issuecomment-882390086, and <nature>org.eclipse.jdt.core.javanature</nature> seems do not work (though no error, but can not navigate to references)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a Multi Module Maven Project in VSCode
After you've created a parent with <packaging>pom<packaging> tag, right-click on plus-sign on "Maven" tab to create a new module, ...
Read more >
Apache Maven Tutorial - Vogella.com
If the packaging type is pom, Maven does not create anything for this project, ... this project's pom.xml, all parent pom, a super-pom...
Read more >
java - "Unable to add module to the current project as it is not ...
"Unable to add module to the current project as it is not of packaging type 'pom'" - How to load a given Maven...
Read more >
Multi-Module Project With Spring Boot
Once we run above command, Maven will create a structure for us along with the pom.xml file. Change the packaging type as pom...
Read more >
Spring Boot - Multi-Module Project - GeeksforGeeks
Change or add '<packaging>pom</packaging>' . Add a sub-module ( Right click on Parent Module -> New -> other -> Maven -> Maven Module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found