Upgrade to IJ2019.2 - unsatisfied dependencies

已回答

I'm compiling my existing plugin against a new version of IntelliJ (2019.2 EA) and I can't run tests because of unsatisfied dependencies.

Can someone suggest how to debug this?  Have the rules changed for how to organize plugin.xml or something?

0

It may be that you have included some libraries from the previous distribution's lib/plugin directories in you project's plugin SDK classpath (File->Project Structure...->SDKs) and did not re-include them after upgrade.  IntelliJ IDEA does not bring your SDK modifications forward to a new installation; you have to do that manually.

Or, perhaps the issue is due to one of these changes? (Documented here.)

Notable Changes in IntelliJ IDEA

Java functionality extracted as plugin
If your plugin depends on Java, it must be specified now, please see blog post for details.
Unbundled plugins
Several plugins for no longer actively maintained technology have been moved to a separate repository. If your plugin depends on them, users will need to install them from the JetBrains plugin repository.

 

0

Thanks, Eric. I have now specified the java plugin in both spots (I didn't know about doing it in plugins.xml, only in build.gradle). It seems I am able to compile against things in the java plugin, but I have trouble at runtime with actually finding the dependencies:

gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder has unsatisfied dependency: class com.intellij.psi.PsiElementFinder among unsatisfiable dependencies: [[class com.intellij.psi.impl.PsiElementFinderImpl], [class com.intellij.psi.PsiElementFinder]] where DefaultPicoContainer (parent=DefaultPicoContainer (root)) was the leaf container being asked for dependencies.

0

Well, when running your tests, the java plugin needs to be in the classpath.  (Add it to your SDK classpath.)

When running in the field, you may have to tell your users to download/install the java plugin, or package it in your own plugin, though I haven't checked the legalities of doing that.  Setting the dependency in the plugin.xml should make IDEA _et al_ prompt the user (and download it automatically) before allowing your plugin to be enabled.

0

Classpath is an interesting thought.

This is not working from IntelliJ *or* from gradle (command line). (We use the Intellij gradle plugin for development.)

So where would I alter the value of classpath so that, for example, the gradle 'runIde' command would pick up the java plugin?  

0

Add it to your SDK.  File->Project Structure->SDKs->[your SDK name]->ClassPath(tab).

0

The correct solution is to add dependency to Java plugin to your build.gradle as described in the linked blog post (https://blog.jetbrains.com/platform/2019/06/java-functionality-extracted-as-a-plugin/):

 

intellij {
plugins 'java'
// ...
}

Then, dependency must be added to plugin.xml as well via

 
<depends>com.intellij.modules.java</depends>

Please also make sure to use the latest EAP version of IntelliJ IDEA as well as latest version for intellij-gradle plugin

1

I have confirmed that all build.gradle files specify the 'java' plugin, the correct <depends> is in the plugin.xml files, and the plugin version is gradle-intellij-plugin:0.4.9

Is there an example plugin which depends on java? And is it possible that, because I'm using the EA, things aren't working quite right?  I didn't know how to make the EA work with the automatic download

intellij { version 'what version for 2019.2 EA?' } 

so I am using

intellij { localPath 'path-to-2019.2.EA' }

and I'm wondering whether that's been tested with a plugin that requires 'java' as a dependency.

0

2019.2 final release is available now, could you try switching to it?

0

Just tried with IC-192.5728.98 and my tests all still fail with messages like

com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError

        Caused by: com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError

            Caused by: com.intellij.openapi.extensions.impl.PicoPluginExtensionInitializationException

                Caused by: org.picocontainer.defaults.UnsatisfiableDependenciesException

0

Please post a full stacktrace and/or link to your plugin's sources

0
ERROR: gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder has unsatisfied dependency: class com.intellij.psi.PsiElementFinder among unsatisfiable dependencies: [[class com.intellij.psi.impl.PsiElementFinderImpl], [class com.intellij.psi.PsiElementFinder]] where DefaultPicoContainer (parent=DefaultPicoContainer (root)) was the leaf container being asked for dependencies.
com.intellij.openapi.extensions.impl.PicoPluginExtensionInitializationException: gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder has unsatisfied dependency: class com.intellij.psi.PsiElementFinder among unsatisfiable dependencies: [[class com.intellij.psi.impl.PsiElementFinderImpl], [class com.intellij.psi.PsiElementFinder]] where DefaultPicoContainer (parent=DefaultPicoContainer (root)) was the leaf container being asked for dependencies.
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.createInstance(ExtensionComponentAdapter.java:50)
at com.intellij.openapi.extensions.impl.XmlExtensionAdapter.createInstance(XmlExtensionAdapter.java:54)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapter(ExtensionPointImpl.java:439)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:410)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensionList(ExtensionPointImpl.java:226)
at com.intellij.openapi.extensions.SmartExtensionPoint.getExtensions(SmartExtensionPoint.java:94)
at gw.gosu.ij.psi.impl.GosuPsiFacadeImpl.finders(GosuPsiFacadeImpl.java:335)
at gw.gosu.ij.psi.impl.GosuPsiFacadeImpl.doFindClass(GosuPsiFacadeImpl.java:172)
at gw.gosu.ij.psi.impl.GosuPsiFacadeImpl.findClass(GosuPsiFacadeImpl.java:153)
at gw.gosu.ij.psi.CommonClasses.getClass(CommonClasses.java:1241)
at gw.gosu.ij.psi.CommonClasses.Object(CommonClasses.java:531)
at gw.gosu.ij.psi.impl.GosuPsiClassImplUtil.getSuperClass(GosuPsiClassImplUtil.java:821)
at gw.gosu.ij.psi.impl.source.GosuPsiClassImpl.getSuperClass(GosuPsiClassImpl.java:256)
at gw.gosu.ij.codeInsight.generation.GosuGenerateConstructorHandler.chooseOriginalMembers(GosuGenerateConstructorHandler.java:86)
at gw.gosu.ij.codeInsight.generation.GosuGenerateMembersHandlerBase.chooseOriginalMembers(GosuGenerateMembersHandlerBase.java:202)
at gw.gosu.ij.codeInsight.generation.GosuGenerateMembersHandlerBase.invoke(GosuGenerateMembersHandlerBase.java:74)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest$1.run(GosuGenerateConstructorTest.java:128)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:347)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.lambda$performCommand$1(GosuGenerateConstructorTest.java:140)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.performCommand(GosuGenerateConstructorTest.java:139)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.performAction(GosuGenerateConstructorTest.java:112)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.lambda$doTest$0(GosuGenerateConstructorTest.java:107)
at gw.gosu.ij.testframework.GosuMultiFileTestCase.doTest(GosuMultiFileTestCase.java:62)
at gw.gosu.ij.testframework.GosuMultiFileTestCase.doTest(GosuMultiFileTestCase.java:47)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.doTest(GosuGenerateConstructorTest.java:106)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.doTest(GosuGenerateConstructorTest.java:102)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.testNoMoreConstructorsCanBeGenerated(GosuGenerateConstructorTest.java:62)
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 junit.framework.TestCase.runTest(TestCase.java:176)
at com.intellij.testFramework.UsefulTestCase.lambda$runTest$12(UsefulTestCase.java:338)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:994)
at com.intellij.testFramework.PlatformTestCase.lambda$invokeTestRunnable$29(PlatformTestCase.java:760)
at com.intellij.testFramework.PlatformTestCase.invokeTestRunnable(PlatformTestCase.java:775)
at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:357)
at com.intellij.testFramework.PlatformTestCase.lambda$runBareImpl$28(PlatformTestCase.java:696)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$3.run(EdtTestUtil.kt:67)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:433)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: org.picocontainer.defaults.UnsatisfiableDependenciesException: gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder has unsatisfied dependency: class com.intellij.psi.PsiElementFinder among unsatisfiable dependencies: [[class com.intellij.psi.impl.PsiElementFinderImpl], [class com.intellij.psi.PsiElementFinder]] where DefaultPicoContainer (parent=DefaultPicoContainer (root)) was the leaf container being asked for dependencies.
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getGreediestSatisfiableConstructor(CachingConstructorInjectionComponentAdapter.java:166)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:81)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:66)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:48)
at com.intellij.openapi.extensions.impl.XmlExtensionAdapter$SimpleConstructorInjectionAdapter.instantiateClass(XmlExtensionAdapter.java:160)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.createInstance(ExtensionComponentAdapter.java:42)
... 58 more
Caused by:
 
org.picocontainer.defaults.UnsatisfiableDependenciesException: gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder has unsatisfied dependency: class com.intellij.psi.PsiElementFinder among unsatisfiable dependencies: [[class com.intellij.psi.impl.PsiElementFinderImpl], [class com.intellij.psi.PsiElementFinder]] where DefaultPicoContainer (parent=DefaultPicoContainer (root)) was the leaf container being asked for dependencies.
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getGreediestSatisfiableConstructor(CachingConstructorInjectionComponentAdapter.java:166)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:81)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:66)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:48)
at com.intellij.openapi.extensions.impl.XmlExtensionAdapter$SimpleConstructorInjectionAdapter.instantiateClass(XmlExtensionAdapter.java:160)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.createInstance(ExtensionComponentAdapter.java:42)
at com.intellij.openapi.extensions.impl.XmlExtensionAdapter.createInstance(XmlExtensionAdapter.java:54)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapter(ExtensionPointImpl.java:439)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:410)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensionList(ExtensionPointImpl.java:226)
at com.intellij.openapi.extensions.SmartExtensionPoint.getExtensions(SmartExtensionPoint.java:94)
at gw.gosu.ij.psi.impl.GosuPsiFacadeImpl.finders(GosuPsiFacadeImpl.java:335)
at gw.gosu.ij.psi.impl.GosuPsiFacadeImpl.doFindClass(GosuPsiFacadeImpl.java:172)
at gw.gosu.ij.psi.impl.GosuPsiFacadeImpl.findClass(GosuPsiFacadeImpl.java:153)
at gw.gosu.ij.psi.CommonClasses.getClass(CommonClasses.java:1241)
at gw.gosu.ij.psi.CommonClasses.Object(CommonClasses.java:531)
at gw.gosu.ij.psi.impl.GosuPsiClassImplUtil.getSuperClass(GosuPsiClassImplUtil.java:821)
at gw.gosu.ij.psi.impl.source.GosuPsiClassImpl.getSuperClass(GosuPsiClassImpl.java:256)
at gw.gosu.ij.codeInsight.generation.GosuGenerateConstructorHandler.chooseOriginalMembers(GosuGenerateConstructorHandler.java:86)
at gw.gosu.ij.codeInsight.generation.GosuGenerateMembersHandlerBase.chooseOriginalMembers(GosuGenerateMembersHandlerBase.java:202)
at gw.gosu.ij.codeInsight.generation.GosuGenerateMembersHandlerBase.invoke(GosuGenerateMembersHandlerBase.java:74)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest$1.run(GosuGenerateConstructorTest.java:128)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:347)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.lambda$performCommand$1(GosuGenerateConstructorTest.java:140)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.performCommand(GosuGenerateConstructorTest.java:139)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.performAction(GosuGenerateConstructorTest.java:112)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.lambda$doTest$0(GosuGenerateConstructorTest.java:107)
at gw.gosu.ij.testframework.GosuMultiFileTestCase.doTest(GosuMultiFileTestCase.java:62)
at gw.gosu.ij.testframework.GosuMultiFileTestCase.doTest(GosuMultiFileTestCase.java:47)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.doTest(GosuGenerateConstructorTest.java:106)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.doTest(GosuGenerateConstructorTest.java:102)
at gw.gosu.ij.codeInsight.GosuGenerateConstructorTest.testNoMoreConstructorsCanBeGenerated(GosuGenerateConstructorTest.java:62)
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 junit.framework.TestCase.runTest(TestCase.java:176)
at com.intellij.testFramework.UsefulTestCase.lambda$runTest$12(UsefulTestCase.java:338)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:994)
at com.intellij.testFramework.PlatformTestCase.lambda$invokeTestRunnable$29(PlatformTestCase.java:760)
at com.intellij.testFramework.PlatformTestCase.invokeTestRunnable(PlatformTestCase.java:775)
at com.intellij.testFramework.UsefulTestCase.runTest(UsefulTestCase.java:357)
at com.intellij.testFramework.PlatformTestCase.lambda$runBareImpl$28(PlatformTestCase.java:696)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$3.run(EdtTestUtil.kt:67)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:433)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
0

No, the setup is there. I just don't think it's working right.

 

0

I can send you sources for the plugin, but I don't have a place to host them. My company infosec department suggests emailing you an encrypted zip file. Is there an email address I can use?

0

Does it work if you put in plugin.xml

<depends>com.intellij.java</depends>

instead of

<depends>com.intellij.modules.java</depends>
0

No...it still can't find the Psi classes for java:

ERROR: gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder has unsatisfied dependency: class com.intellij.psi.impl.PsiElementFinderImpl among unsatisfiable dependencies: [[class com.intellij.psi.PsiElementFinder], [class com.intellij.psi.impl.PsiElementFinderImpl]] where DefaultPicoContainer (parent=DefaultPicoContainer (root)) was the leaf container being asked for dependencies.

0

Where can I find sources for your plugin? Or could you c/p all CTORs declared in JavaForGosuPsiElementFinder here? Thanks

0

I don't have the sources in a public repository -- I would have to email them to you.

Here is the beginning of that source file:

package gw.gosu.ij.interoperability.javaAsGosu;

import com.intellij.openapi.project.DumbAware;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElementFinder;
import com.intellij.psi.impl.PsiElementFinderImpl;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.Processor;
import gw.gosu.ij.interoperability.gosuAsJava.psi.GosuPackageForJava;
import gw.gosu.ij.interoperability.javaAsGosu.psi.JavaClassForGosu;
import gw.gosu.ij.interoperability.javaAsGosu.psi.JavaPackageForGosu;
import gw.gosu.ij.psi.AbstractGosuPsiElementFinder;
import gw.gosu.ij.psi.GosuPsiClass;
import gw.gosu.ij.psi.GosuPsiPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;

public class JavaForGosuPsiElementFinder extends AbstractGosuPsiElementFinder implements DumbAware {
private final PsiElementFinder javaElementFinder;

public JavaForGosuPsiElementFinder(PsiElementFinderImpl javaElementFinder) {
this.javaElementFinder = javaElementFinder;
}

protected JavaForGosuPsiElementFinder(PsiElementFinder javaElementFinder) {
this.javaElementFinder = javaElementFinder;
}

0

Referenced in plugin.xml as

<java.elementFinder implementation="gw.gosu.ij.interoperability.javaAsGosu.JavaForGosuPsiElementFinder"/>
0

Thanks. Why do you have two CTORs, once for PsiElementFinder and then again its *Impl? please try removing the *Impl CTOR-variant if possible.

0

I don't know the reason; I didn't create this code.

Removing the extra constructor gets rid of half the problem -- it no longer complains about the Impl class but it still can't find PsiElementFinder.

0

OK, I seem to have found it. PicoContainer wants the finders to have a public constructor which takes arguments (Project) or (Project, FileManager). I had to change this in a couple of places, and now the plugin is initializing properly.

Thanks for your suggestions -- they steered me in a productive direction.

 

0

Thanks, Richard. Indeed such CTOR arguments on extension points are not allowed in 2019.2 anymore, we'll update docs shortly.

0

请先登录再写评论。