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

Verify pom co-ordinates when found via a relative path (fixes #482) #483

Merged
merged 3 commits into from
Jan 11, 2022

Conversation

josple
Copy link
Contributor

@josple josple commented Jan 10, 2022

When resolving a parent POM via a relative path verify that any POM found has co-ordinates that match the parent being sought.

When resolving a parent POM via a relative path verify that any POM found has co-ordinates that match the parent being sought.
@josple josple changed the title Verify pom co-ordinates when found via a relative path Verify pom co-ordinates when found via a relative path (fixes #482) Jan 10, 2022
@josple
Copy link
Contributor Author

josple commented Jan 10, 2022

I am struggling to run tests locally in my Eclipse IDE (installed via the m2e oomph setup). Does anyone know how best to fix the following error:

11:49:14.756` [main] ERROR org.eclipse.m2e.core.internal.project.registry.ProjectRegistryRefreshJob - org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) null returned by binding at org.eclipse.sisu.wire.LocatorWiring
 but the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source) is not @Nullable
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.IndexerEngine
    for the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultIndexer
  while locating java.lang.Object annotated with *
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.Indexer
    for the 1st parameter of org.apache.maven.index.DefaultNexusIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultNexusIndexer
  while locating java.lang.Object annotated with *

1 error
      role: org.apache.maven.index.NexusIndexer
  roleHint: 
org.eclipse.m2e.core.internal.NoSuchComponentException: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) null returned by binding at org.eclipse.sisu.wire.LocatorWiring
 but the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source) is not @Nullable
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.IndexerEngine
    for the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultIndexer
  while locating java.lang.Object annotated with *
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.Indexer
    for the 1st parameter of org.apache.maven.index.DefaultNexusIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultNexusIndexer
  while locating java.lang.Object annotated with *

1 error
      role: org.apache.maven.index.NexusIndexer
  roleHint: 
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.getIndexer(NexusIndexManager.java:719)
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.getIndexingContext(NexusIndexManager.java:710)
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.repositoryRemoved(NexusIndexManager.java:1014)
	at org.eclipse.m2e.core.internal.repository.RepositoryRegistry.removeRepository(RepositoryRegistry.java:193)
	at org.eclipse.m2e.core.internal.repository.RepositoryRegistry.removeProjectRepositories(RepositoryRegistry.java:182)
	at org.eclipse.m2e.core.internal.repository.RepositoryRegistry.mavenProjectChanged(RepositoryRegistry.java:129)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:818)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:985)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryRefreshJob.lambda$0(ProjectRegistryRefreshJob.java:148)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:182)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:156)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:103)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1416)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryRefreshJob.run(ProjectRegistryRefreshJob.java:83)
	at org.eclipse.m2e.tests.common.JobHelpers.flushProcessingQueues(JobHelpers.java:111)
	at org.eclipse.m2e.tests.common.JobHelpers.waitForJobsToComplete(JobHelpers.java:87)
	at org.eclipse.m2e.tests.common.JobHelpers.waitForJobsToComplete(JobHelpers.java:53)
	at org.eclipse.m2e.tests.common.WorkspaceHelpers.doCleanWorkspace(WorkspaceHelpers.java:91)
	at org.eclipse.m2e.tests.common.WorkspaceHelpers.cleanWorkspace(WorkspaceHelpers.java:59)
	at org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase.tearDown(AbstractMavenProjectTestCase.java:162)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.RunAfters.invokeMethod(RunAfters.java:46)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:74)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:45)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4035)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3635)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:53)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) null returned by binding at org.eclipse.sisu.wire.LocatorWiring
 but the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source) is not @Nullable
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.IndexerEngine
    for the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultIndexer
  while locating java.lang.Object annotated with *
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.Indexer
    for the 1st parameter of org.apache.maven.index.DefaultNexusIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultNexusIndexer
  while locating java.lang.Object annotated with *

1 error
      role: org.apache.maven.index.NexusIndexer
  roleHint: 
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:249)
	at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.getIndexer(NexusIndexManager.java:717)
	... 77 common frames omitted
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) null returned by binding at org.eclipse.sisu.wire.LocatorWiring
 but the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source) is not @Nullable
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.IndexerEngine
    for the 2nd parameter of org.apache.maven.index.DefaultIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultIndexer
  while locating java.lang.Object annotated with *
  at org.eclipse.sisu.wire.LocatorWiring
  while locating org.apache.maven.index.Indexer
    for the 1st parameter of org.apache.maven.index.DefaultNexusIndexer.<init>(Unknown Source)
  at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.index.DefaultNexusIndexer
  while locating java.lang.Object annotated with *

1 error
	at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
	at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
	at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
	at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
	... 80 common frames omitted

!ENTRY org.eclipse.m2e.core 4 -1 2022-01-10 11:49:15.773
!MESSAGE Could not lookup required component
!STACK 0
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
      role: org.apache.maven.execution.MavenExecutionRequestPopulator
  roleHint: 
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:249)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.lookup(MavenImpl.java:1329)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.createExecutionRequest(MavenImpl.java:238)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.createExecutionRequest(MavenImpl.java:213)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.getMirrors(MavenImpl.java:1225)
	at org.eclipse.m2e.core.internal.repository.RepositoryRegistry.updateRegistry(RepositoryRegistry.java:227)
	at org.eclipse.m2e.core.internal.repository.RepositoryRegistryUpdateJob.run(RepositoryRegistryUpdateJob.java:50)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.util.NoSuchElementException
	at java.base/java.util.Collections$EmptyIterator.next(Collections.java:4210)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
	... 9 more

Fix test by including missing profile from the maven Settings file that has been added.

fixes eclipse-m2e#482
@josple
Copy link
Contributor Author

josple commented Jan 10, 2022

I am struggling to work out why the WarnIfGroupSameThanParentTest test is failing. I have a suspicion that the warning markings order may be non deterministic and the test should be made agnostic to this (no idea currently why my changes may have exposed this) but I am stabbing in the dark here as I am unable to run the test locally and debug it.

@mickaelistria, have you previously seen any error like the error log I presented in my previous comment? Any ideas on how to fix this so that I can run tests locally in my IDE?

@mickaelistria
Copy link
Contributor

have you previously seen any error like the error log I presented in my previous comment? Any ideas on how to fix this so that I can run tests locally in my IDE?

I have seen it a few times when the org.eclipse.m2e.maven.runtime bundles have some trouble. But to be honest, @HannesWell changed many things (for the better) in how they were built lately and I didn't have the need/opportunity to re-look at them since then, and I never ever have used Oomph for m2e so I don't think I can be much helpful.

@josple
Copy link
Contributor Author

josple commented Jan 10, 2022

The error listed above was due to not running the Maven Launch-Configuration 'm2e-maven-runtime--generate-OSGi-metadata' in my IDE prior to running the tests.

I have run the above Maven goal and I am now able to run and debug the tests locally 👍

@HannesWell
Copy link
Contributor

The error listed above was due to not running the Maven Launch-Configuration 'm2e-maven-runtime--generate-OSGi-metadata' in my IDE prior to running the tests.

I have run the above Maven goal and I am now able to run and debug the tests locally 👍

Did you only use the Oomph Installer do install your Eclipse IDE or did you also use the m2e Oomph setup?
Because when using the m2e-setup the mentioned launch-configuration is executed at each start of your m2e workspace.

Update submodule commit hash to link to.
@josple
Copy link
Contributor Author

josple commented Jan 10, 2022

@HannesWell: Did you only use the Oomph Installer do install your Eclipse IDE or did you also use the m2e Oomph setup?
Because when using the m2e-setup the mentioned launch-configuration is executed at each start of your m2e workspace.
I believe I used the m2e Oomph setup i.e. I did the following:

  1. Downloaded the Eclipse installer
  2. Started the installer executable
  3. Dragged and dropped the m2e Oomph link provided here: https://github.com/eclipse-m2e/m2e-core/blob/master/CONTRIBUTING.md#%EF%B8%8F-setting-up-the-development-environment-automatically-using-the-eclipse-installer-oomph
  4. Clicked through the rest of the installation without changing any of the defaults

Is the mentioned launch-config configured in the Maven lifecycle as well? Or only executed on each start of the workspace? I cleaned the modules in my workspace at one point - so that may explain it.

@josple
Copy link
Contributor Author

josple commented Jan 10, 2022

This PR is failing due to tests in the separate Git submodule: https://github.com/tesla/m2e-core-tests. I have created a PR for updating the failing test which should be safe without the changes in this code. It is a speculative fix - more details can be found in the PR: tesla/m2e-core-tests#134

Is there a way to run CI of this PR against my fork of the https://github.com/tesla/m2e-core-tests repo, or generally a better way of verifying these two changes together?

@HannesWell
Copy link
Contributor

@HannesWell: Did you only use the Oomph Installer do install your Eclipse IDE or did you also use the m2e Oomph setup?
Because when using the m2e-setup the mentioned launch-configuration is executed at each start of your m2e workspace.
I believe I used the m2e Oomph setup i.e. I did the following:

1. Downloaded the Eclipse installer

2. Started the installer executable

3. Dragged and dropped the m2e Oomph link provided here: https://github.com/eclipse-m2e/m2e-core/blob/master/CONTRIBUTING.md#%EF%B8%8F-setting-up-the-development-environment-automatically-using-the-eclipse-installer-oomph

4. Clicked through the rest of the installation without changing any of the defaults

This actually sounds like the correct workflow.

Is the mentioned launch-config configured in the Maven lifecycle as well? Or only executed on each start of the workspace? I cleaned the modules in my workspace at one point - so that may explain it.

At the moment it is unfortunately not part of the M2E workspace build and only executed on each start or if you manually perform all setup tasks or run it directly.
But I'm currently reworking those embedded maven runtime bundles again to make even that happen (with the help of Christoph Läubrich). See PR here if you are interested.

@HannesWell
Copy link
Contributor

Is there a way to run CI of this PR against my fork of the https://github.com/tesla/m2e-core-tests repo, or generally a better way of verifying these two changes together?

You can simply run the launch-config m2e-core--build-with-integration-tests locally in your workspace. This executes the same build like in the M2E Jenkins CI.
Just to confirm, the tests you just fixed are imported into your M2E workspace by M2E's Oomph setup? Since you fixed them I assume you have them.

@josple
Copy link
Contributor Author

josple commented Jan 11, 2022

At the moment it is unfortunately not part of the M2E workspace and only executed on each start or if you manually perform all setup tasks or run it directly. But I'm currently reworking those embedded maven runtime bundles again...

Nice, the standardisation changes you have been making since I last made a change to this project have been helpful already 👍. In the interim if anyone encounters this edge case hopefully their search will find this ticket for the simple solution.

Just to confirm, the tests you just fixed are imported into your M2E workspace by M2E's Oomph setup?

Yes, that worked great. However, I only ran these tests individually via a JUnit run configuration (and they passed) rather than via the integration Maven launch config you mentioned - so that may explain why I failed to reproduce the issue. Next time I will see if that helps - thanks!

@josple
Copy link
Contributor Author

josple commented Jan 11, 2022

@mickaelistria - thank you for merging tesla/m2e-core-tests#134. It looks like the speculative fix to a seemingly unimpacted test has worked - so I think this PR is ready to be reviewed in consideration for being merged.

@mickaelistria
Copy link
Contributor

Thanks!

@mickaelistria mickaelistria merged commit c351b19 into eclipse-m2e:master Jan 11, 2022
@josple josple deleted the bug-482 branch January 11, 2022 13:20
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

Successfully merging this pull request may close these issues.

Relative path POM resolution via the profile selection dialogue can resolve the incorrect POM
3 participants