redhat-developer / redhat-developer/vscode-java

Pom include lifecycle-mapping, An error occurred: Java Model Exception: Java Model Status

Open
#1,402 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Maven
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

An error will be reported when the Mavne project contains:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<!-- ... -->
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<!-- ... -->
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
</project>

error log output

[Error - 上午11:12:02] 2020-4-21 11:12:02 Problem load project library 
test does not exist
Java Model Exception: Java Model Status [test does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:573)
	at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(JavaModelManager.java:2526)
	at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(JavaProject.java:2347)
	at org.eclipse.jdt.internal.core.JavaProject.getRawClasspath(JavaProject.java:2376)
	at com.microsoft.jdtls.ext.core.PackageCommand.getContainers(PackageCommand.java:239)
	at com.microsoft.jdtls.ext.core.PackageCommand.getChildren(PackageCommand.java:103)
	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:477)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:74)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Environment
  • Operating System: OSX 10.15.4
  • JDK version: 1.8
  • Visual Studio Code version: 1.44.1
  • Java extension version: 0.60
Steps To Reproduce
mvn archetype:generate                               \
      -DarchetypeGroupId=org.apache.flink              \
      -DarchetypeArtifactId=flink-quickstart-java      \
      -DarchetypeVersion=1.10.0
Current Result

use vscode open project, No error message. But will fail to build. Only view the error message through the Output panel

when I remove lifecycle-mapping from pom.xml, Extension works good.

Expected Result

At least give an obvious error message. Best to solve this problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided mvn archetype:generate command and inspect PackageCommand.getContainers and PackageCommand.getChildren, where the stack trace reports the failure. Compare behavior with and without the lifecycle-mapping plugin; done means the project loads without the Java Model Exception or presents an obvious error instead of failing silently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.