Community
Participate
Working Groups
Created attachment 278576 [details] Import toto/tata into the worskpace to reproduce the issue https://git.eclipse.org/c/m2e/m2e-core.git/commit/?id=d0cd1dbaf370f7e7602c21ed653abc1e4f825f0a causes a project defining a parent project to fail loading with `Could not read maven project`, if the parent folder contains a different maven project than the one defined in the pom. The error is thrown from: ProjectRegistryManager.readProjectWithDependencies(IFile, ResolverConfiguration, IProgressMonitor) line: 854 ProjectRegistryManager$2.call() line: 1062 ProjectRegistryManager$2.call() line: 1 LocalCache$LocalManualCache$1.load(Object) line: 5065 LocalCache$LoadingValueReference<K,V>.loadFuture(K, CacheLoader<? super K,V>) line: 3716 LocalCache$Segment<K,V>.loadSync(K, int, LoadingValueReference<K,V>, CacheLoader<? super K,V>) line: 2424 LocalCache$Segment<K,V>.lockedGetOrLoad(K, int, CacheLoader<? super K,V>) line: 2298 LocalCache$Segment<K,V>.get(K, int, CacheLoader<? super K,V>) line: 2211 LocalCache<K,V>.get(K, CacheLoader<? super K,V>) line: 4154 LocalCache$LocalManualCache<K,V>.get(K, Callable<? extends V>) line: 5060 ProjectRegistryManager.getMavenProject(MavenProjectFacade, IProgressMonitor) line: 1060 MavenProjectFacade.getMavenProject(IProgressMonitor) line: 242 MavenBuilder$BuildMethod$1.call(IMavenExecutionContext, IProgressMonitor) line: 99 MavenExecutionContext.executeBare(MavenProject, ICallable<V>, IProgressMonitor) line: 177 MavenExecutionContext.execute(MavenProject, ICallable<V>, IProgressMonitor) line: 151 MavenExecutionContext.execute(ICallable<V>, IProgressMonitor) line: 99 MavenBuilder$1(MavenBuilder$BuildMethod<T>).execute(int, Map<String,String>, IProgressMonitor) line: 87 MavenBuilder.build(int, Map<String,String>, IProgressMonitor) line: 201 BuildManager$2.run() line: 833 SafeRunner.run(ISafeRunnable) line: 45 BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 220 BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 263 BuildManager$1.run() line: 316 SafeRunner.run(ISafeRunnable) line: 45 BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 319 BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 371 BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 392 AutoBuildJob.doBuild(IProgressMonitor) line: 154 AutoBuildJob.run(IProgressMonitor) line: 244 Worker.run() line: 63 The issue is really caused by warnings (Project build error: 'parent.relativePath' of POM bar.foo:tata:0.0.1-SNAPSHOT (/Users/fbricon/Dev/workspaces/runtime-m2e-1.12/toto/tata/pom.xml) points at foo.bar:toto instead of io.takari:takari, please verify your project structure) being turned into catastrophic errors. CLI builds don't fail, m2e 1.11 neither.
I'm not able to reproduce this. I'm using an IDE with m2e commit 15d9b8d7181c39369615107519830590b6d7a2b4 , taking the zip, doing File > Import... > Existing maven project to import "tata" from your example (I have toto as parent folder with the pom in it), and I can import. I only see the warning on parent, no "Could not read maven project". Are you using different steps?
(In reply to Mickael Istria from comment #1) > I'm not able to reproduce this. > I'm using an IDE with m2e commit 15d9b8d7181c39369615107519830590b6d7a2b4 , > taking the zip, doing File > Import... > Existing maven project to import > "tata" from your example (I have toto as parent folder with the pom in it), > and I can import. I only see the warning on parent, no "Could not read maven > project". > Are you using different steps? If you can directly submit a patch that reproduces this issue in a test case (see RegistryTest for similar ones), that'd be even better ;)
We also have a reactor pom which not the parent pom of the submodules. I see the problem when doing "Update Project..." (in our workspace, haven't tried the attachment) in a module which misses the "<relativePath />" in the "<parent>"-tag
(In reply to Till Brychcy from comment #3) > We also have a reactor pom which not the parent pom of the submodules. > > I see the problem when doing "Update Project..." (in our workspace, haven't > tried the attachment) in a module which misses the "<relativePath />" in the > "<parent>"-tag Can you please detail, with an example project (ideally the one shared by Fred on this ticket), exact steps to reproduce this issue?
Immediately happens with the attached zip (I just imported tata). As described, touch and saving makes the error go away, "Update project" returns it. (I run m2e from source)
Ok, I could finally reproduce it. Working on it right now.
Happens since commit d0cd1dbaf370f7e7602c21ed653abc1e4f825f0a
While I think I found an acceptable solution, I do not manage to reproduce it in a test case, while I can reproduce it with a debugged IDE, and comparing the execution path seem very similar. It seems like MavenImpl#readMavenProjects() can behave a bit differently (in some cases ignoring the warnings, in some other adding the warnings). Does anyone have an idea what can cause that? Some preference maybe?
It could be related to warnings in general: I just noted it also happens in another project that is not part of a reactor, but has a warning caused by a parent pom. Warning was; "Project build error: Reporting configuration should be done in <reporting> section, not in maven-site-plugin <configuration> as reportPlugins parameter.". After updating to a parent pom version where this was fixed, the problem went away.
I looks like you've already found a solution, but here is an example pom.xml, for my previous comment, maybe it is easier to create a test case with this: (store in pom.xml in a new directory and import as maven project) <?xml version="1.0" encoding="UTF-8"?> <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"> <modelVersion>4.0.0</modelVersion> <groupId>test.group</groupId> <artifactId>test.artifact</artifactId> <version>1.0.0</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>3.3</version> <configuration> <reportPlugins> </reportPlugins> </configuration> </plugin> </plugins> </build> </project>
New Gerrit change created: https://git.eclipse.org/r/142135
Merged.
Gerrit change https://git.eclipse.org/r/142135 was merged to [master]. Commit: http://git.eclipse.org/c/m2e/m2e-core.git/commit/?id=9ad76e58f6c968bbd2c934202b0a404f052e0ad6
Moved to https://github.com/eclipse-m2e/m2e-core/issues/