Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalArgumentException: Path must include project and resource name: / #1790

Open
perceptron8 opened this issue Jul 19, 2024 · 5 comments

Comments

@perceptron8
Copy link

What steps will reproduce the problem?

  1. git clone https://github.com/google/guava
  2. Import -> Existing Maven Projects*
  3. Maven -> Update project... -> OK

* you may like to use [groupId].[artifactId] as "Name template" to avoid name conflicts

-- Error Details --
Date: Fri Jul 19 09:08:02 CEST 2024
Message: Could not update project com.google.guava.guava configuration
Severity: Error
Product: Eclipse IDE 4.32.0.20240606-0749 (org.eclipse.epp.package.jee.product)
Plugin: org.eclipse.m2e.core
Session Data:
eclipse.buildId=4.32.0.20240606-1231
java.version=21.0.3
java.vendor=Ubuntu
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product -clean

Exception Stack Trace:
java.lang.IllegalArgumentException: Path must include project and resource name: /
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:68)
	at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2223)
	at org.eclipse.core.internal.resources.Container.getFolder(Container.java:200)
	at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.getFolder(AbstractJavaProjectConfigurator.java:907)
	at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.addResourceDirs(AbstractJavaProjectConfigurator.java:544)
	at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.addProjectSourceFolders(AbstractJavaProjectConfigurator.java:398)
	at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.configure(AbstractJavaProjectConfigurator.java:168)
	at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:127)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:506)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:500)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$4(ProjectConfigurationManager.java:426)
	at java.base/java.util.Collection.removeIf(Collection.java:583)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:414)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$3(ProjectConfigurationManager.java:340)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:278)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1053)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:339)
	at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:80)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
@abuech2s
Copy link

abuech2s commented Jul 26, 2024

I receive the same error stack.

  • Building by cmd works.
  • Building in Eclipse does not work - creating the same stack like above.

What are the steps to reproduce the problem?

  • Attached is a minimal example, which has exactly the problem (independently from the guava example above)
  • My example contains a main project including one submodule.
  • On the root layer you can find a file releasenotes.txt, which should be copied to the target-directory (or to all target directories in case of having multiple submodules) at deploy target
  • The submodule includes the root layer as a <resource>, which has always worked so far (<directory>..</directory>).

It seems, that m2e/Eclipse does not accept the root layer ( / ) as a directory anymore.
The critical line is therefore at minexample\mymodule1\src\main\java\mymodule1\Module1.java at line 23. Imo, in case you route this <directory> by using .. to the root layer, the error appears.

In case, you use some other directorypath, e.g. <directory>.</directory> (current submodule-dir), eclipse would accept this.

How to build?

  • In Cmd : mvn clean package
  • In eclipse: Import project, right click Maven -> Update project -> OK

Error:

image

Technical details:

Apache Maven 3.9.7 (8b094c9513efc1b9ce2d952b3b9c8eaedaf8cbf0)
Maven home: C:\Users\<Username>\Documents\apache-maven-3.9.7
Java version: 1.8.0_312, vendor: Temurin, runtime: C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\jre

Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
eclipse.buildId=4.32.0.20240606-1231
java.version=22.0.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

image

minexample.zip

@abuech2s
Copy link

Is there any timeslot/plan from the development-team here to fix this problem?

@laeubi
Copy link
Member

laeubi commented Aug 14, 2024

There is no "development team" only some people working on their free time, if you can reproduce and like to provide a fix contributions are welcome.

If this is crucial to someones business and likes to speed up the development in that area a sponsoring would allow me to assign more time-slots or contact me directly for contracted work to fix a particular issue.

@abuech2s
Copy link

I appreciate spending the free time for such a project. So, I already was able to reproduce it, and prepared the minimal example - hope this example helped to show the developer, what went wrong.

@jochenw
Copy link

jochenw commented Nov 26, 2024

How to reproduce this problem:
git clone https://gitbox.apache.org/repos/asf/creadur-rat.git

  1. Clone the Apache Rat project, like so: git clone https://gitbox.apache.org/repos/asf/creadur-rat.git.
  2. In Eclipse (I am using 4.34RC2 with M2E 2.6.2.20240828-1954), select "Import ..." and then Maven / "Existing Maven Projects". When asked to select to the import directory, navigate to the root of the project, that was just cloned. Make sure, that "Nested import" is activated. The import should fail for four of the five subprojects. For those subprojects, I can reproduce the same problem again by running "Maven / Update Maven project" on them. For more details see RAT-379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants