eclipse-pde-partial-idea
eclipse-pde-partial-idea copied to clipboard
Could not instantiate requested DependencyResolver component with role = p2
After upgrading from Tycho 2.7.x to 3.0.4, I am seeing this in all OSGi modules, trying to import them from Maven. The result is that no OSGi modules can be imported and classes not be resolved anymore at all. I am not sure if this is related to this plugin or to some IntelliJ IDEA Maven tooling.
2023-04-09 13:36:23,835 [89730683] INFO - #o.j.i.maven - java.lang.RuntimeException: Could not instantiate requested DependencyResolver component with role = p2
at org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory.lookupDependencyResolver(DefaultDependencyResolverFactory.java:68)
at org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory.lookupDependencyResolver(DefaultDependencyResolverFactory.java:43)
at org.eclipse.tycho.core.resolver.DefaultTychoResolver.setupProject(DefaultTychoResolver.java:109)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:139)
at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.loadExtensions(Maven3XServerEmbedder.java:1097)
at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.lambda$doResolveProject$2(Maven3XServerEmbedder.java:891)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedder$1.run(Maven3ServerEmbedder.java:366)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedder.executeWithSessionScope(Maven3ServerEmbedder.java:441)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedder.executeWithMavenSession(Maven3ServerEmbedder.java:374)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedder.executeWithMavenSession(Maven3ServerEmbedder.java:363)
at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.doResolveProject(Maven3XServerEmbedder.java:849)
at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.resolveProject(Maven3XServerEmbedder.java:798)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error notifying InjectionListener org.eclipse.sisu.plexus.PlexusBeanBinder@1443d7f8 of org.eclipse.tycho.p2.resolver.P2DependencyResolver.
Reason: java.lang.NullPointerException: P2ResolverFactory service is missing
while locating org.eclipse.tycho.p2.resolver.P2DependencyResolver
at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:3.0.4, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@659e0bfd] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.eclipse.tycho.core.DependencyResolver annotated with @com.google.inject.name.Named(value="p2")
1 error
role: org.eclipse.tycho.core.DependencyResolver
roleHint: p2
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
at org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory.lookupDependencyResolver(DefaultDependencyResolverFactory.java:66)
... 28 more
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error notifying InjectionListener org.eclipse.sisu.plexus.PlexusBeanBinder@1443d7f8 of org.eclipse.tycho.p2.resolver.P2DependencyResolver.
Reason: java.lang.NullPointerException: P2ResolverFactory service is missing
while locating org.eclipse.tycho.p2.resolver.P2DependencyResolver
at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:3.0.4, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@659e0bfd] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.eclipse.tycho.core.DependencyResolver annotated with @com.google.inject.name.Named(value="p2")
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.Guice4$1.get(Guice4.java:162)
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)
... 30 more
Caused by: java.lang.NullPointerException: P2ResolverFactory service is missing
at java.base/java.util.Objects.requireNonNull(Objects.java:233)
at org.eclipse.tycho.p2.resolver.P2DependencyResolver.initialize(P2DependencyResolver.java:497)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.initialize(PlexusLifecycleManager.java:303)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate(PlexusLifecycleManager.java:207)
at org.eclipse.sisu.bean.BeanScheduler.schedule(BeanScheduler.java:151)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.manage(PlexusLifecycleManager.java:147)
at org.eclipse.sisu.plexus.PlexusBeanBinder.afterInjection(PlexusBeanBinder.java:72)
at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:131)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:125)
at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32)
at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:98)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:93)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1050)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:66)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1050)
... 34 more
2023-04-09 13:36:23,866 [89730714] INFO - #o.j.i.m.p.MavenProjectsProcessor - [maven import] MavenProjectsProcessorResolvingTask took 2234ms
This is a mix of IntelliJ and Tycho not cooperating.
You can try to delete the m2 and p2 directory under your user home directory, and reimport the project. But AFAIR it doesn't work most of the times.
Is there anything to work around this reliably? Can you open an IDEA issue and describe it correctly? I think I cannot. I open and track IDEA issues myself normally, but only if I can describe them adequately.
Alexander, you can try out my fork of IntelliJ if you want. As I explained in the Tycho issue you also contributed to, IntelliJ is not capable of importing Tycho projects. And it gets worse every Tycho release.
https://github.com/lppedd/intellij-community/releases/tag/IC231-060420231412
Tho, why are you importing Maven projects? If you're using this plugin you should not work with Maven.
@lppedd, I am aware of https://github.com/eclipse-tycho/tycho/issues/1054 and your Community Edition fork. As an Ultimate Edition user, I simply hope that they fix the product and add a production-ready version of your patch for Tycho support.
why are you importing Maven projects? If you're using this plugin you should not work with Maven
Really? But my project is a Tycho Maven project, so naturally I want Maven to be the leading system, like in all my other Maven projects. The Maven build is the reference, and it works. I build my releases using it. I simply want to be able to also build the same set of plugins and features from IDEA in order to be able to navigate the code, resolve types or run the occasional test.
You can try to delete the m2 and p2 directory under your user home directory, and reimport the project.
I certainly won't do that, because it would mean Gigabytes of new dependency downloads for dozens of projects without fixing the root cause of the problem, simply hoping that it might work. Neither of the two directories are corrupt, otherwise Maven builds would not work. So deleting them does not make any sense either.
@kriegaex you'll have to use this plugin to configure PDE projects inside of IntelliJ, without importing Maven projects.
You'll use Maven from the command line to build as usual.
Oh, I think I am one step further. After an Eclipse upgrade, I had to re-wire the path to the new location of "File | Settings | Languages & Frameworks | Eclipse Target" for PDE Partial to be able to resolve the libraries. Now I have made some progress, but have met several other problems, among them https://youtrack.jetbrains.com/issue/IDEA-317569, just to name one.