Language Support for Java(TM) by Red Hat - org.eclipse.jdt.ls.core Initialization failed Path for project must have only one segment.
See original GitHub issueHello everybody,
I get the following error when I try to open a folder project in VScode.
!ENTRY org.eclipse.jdt.ls.core 4 0 2019-05-15 14:52:12.232 !MESSAGE Initialization failed !STACK 0 java.lang.IllegalArgumentException: Path for project must have only one segment. at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66) at org.eclipse.core.internal.resources.WorkspaceRoot.getProject(WorkspaceRoot.java:150) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.create(ProjectConfigurationManager.java:980) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:162) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1336) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:143) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:133) at org.eclipse.jdt.ls.core.internal.managers.MavenProjectImporter.importToWorkspace(MavenProjectImporter.java:188) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:147) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:137) at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:245) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
This is a problem for me because I cannot see, for example, if I forgot to put an import for a specific class. Anyway, I notated a strange behavior during extension using. I have some projects the extensions wors well in, some others the extension doesn’t work getting the above error. I’ve already tried to delete and re-install VScode and the extension, but the result is the same.
Attached I put my pom.xml and my logs. Language Support Java.log
Thanks for your support. Simone
Environment
- Operating System: Windows 10
- JDK version: 1.8.0_144
- Visual Studio Code version: 1.33.1
- Java extension version: 0.44.0
Steps To Reproduce
- Try to build a project with attached pom.xml
- See if the Language Support for Java is correctly initialized
- Then, try to type a new class (for example … = new JSONObject(…))
- See if VScode checks the class import existing.
[attach a sample project reproducing the error] attach logs
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
I think that the artifactId value is not being resolved. I had the same issue. Tried replacing: < artifactId>${applicationName}</ artifactId> With: < artifactId>abc</ artifactId>
And the problem solved for me. This is just a work around, since in the command line the pom.xml works as is (in my case).
Source: https://stackoverflow.com/questions/13197092/how-can-i-fix-path-for-project-must-have-only-one-segment-error-when-creating
Dear all,
I solved the problem. I had to put the following configuration in pom.xml
<groupId>world.dedicated</groupId> <artifactId>DMP_Watchdog</artifactId> <version>0.0.1</version> <packaging>jar</packaging>
instead of:
<groupId>world.dedicated</groupId> <artifactId>${applicationName}</artifactId> <version>${appVersion}</version> <packaging>jar</packaging>
Thanks for your support Simone