Python Core plugin fails, halting plugin development

I've been walking through the guides on creating an IntelliJ plugin. I've hit a snag, and I'm not sure how to resolve it.

I was able to clone IntelliJ Community Edition and build it. My own separate plugin project, though, every time I use the Run/Debug configuration, I get this error:

2017-12-06 16:35:06,509 [ 6692] ERROR - ion.ex.InspectionToolRegistrar - Short name 'RestRoleInspection' is not unique
class 'com.jetbrains.rest.inspections.RestRoleInspection' in PluginDescriptor[name='Python ReStructureText Integration', classpath='/Users/jonny/work/idea-community/out/production/python-rest']
and
class'com.jetbrains.rest.inspections.RestRoleInspection' in PluginDescriptor[name='Python Community Edition', classpath='/Users/jonny/work/idea-community/out/production/python-community-plugin-resources']
conflict [Plugin: org.jetbrains.plugins.python-rest]
com.intellij.diagnostic.PluginException: Short name 'RestRoleInspection' is not unique
class 'com.jetbrains.rest.inspections.RestRoleInspection' in PluginDescriptor[name='Python ReStructureText Integration', classpath='/Users/jonny/work/idea-community/out/production/python-rest']
and
class'com.jetbrains.rest.inspections.RestRoleInspection' in PluginDescriptor[name='Python Community Edition', classpath='/Users/jonny/work/idea-community/out/production/python-community-plugin-resources']
conflict [Plugin: org.jetbrains.plugins.python-rest]
at com.intellij.codeInspection.ex.InspectionToolRegistrar.checkForDuplicateShortName(InspectionToolRegistrar.java:86)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.ensureInitialized(InspectionToolRegistrar.java:60)
at com.intellij.codeInspection.ex.InspectionToolRegistrar.createTools(InspectionToolRegistrar.java:127)
at com.intellij.codeInspection.ex.InspectionSearchableOptionContributor.processOptions(InspectionSearchableOptionContributor.java:34)
at com.intellij.ide.ui.search.SearchableOptionPreloader.preload(SearchableOptionPreloader.java:49)
at com.intellij.openapi.application.Preloader.lambda$null$0(Preloader.java:74)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:534)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:479)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.application.Preloader.lambda$initComponent$1(Preloader.java:72)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2017-12-06 16:35:06,510 [ 6693] ERROR - ion.ex.InspectionToolRegistrar - IntelliJ IDEA 2017.3 Build #IC-173.SNAPSHOT
2017-12-06 16:35:06,510 [ 6693] ERROR - ion.ex.InspectionToolRegistrar - JDK: 1.8.0_151
2017-12-06 16:35:06,510 [ 6693] ERROR - ion.ex.InspectionToolRegistrar - VM: Java HotSpot(TM) 64-Bit Server VM
2017-12-06 16:35:06,510 [ 6693] ERROR - ion.ex.InspectionToolRegistrar - Vendor: Oracle Corporation
2017-12-06 16:35:06,510 [ 6693] ERROR - ion.ex.InspectionToolRegistrar - OS: Mac OS X
2017-12-06 16:35:06,510 [ 6693] ERROR - ion.ex.InspectionToolRegistrar - Last Action:
2017-12-06 16:35:07,228 [ 7411] INFO - .openapi.application.Preloader - Finished preloading com.intellij.ide.ui.search.SearchableOptionPreloader@4302f056
2017-12-06 16:35:07,533 [ 7716] INFO - .openapi.application.Preloader - Finished preloading com.intellij.codeInsight.completion.CompletionPreloader@3628b012
2017-12-06 16:36:15,911 [ 76094] INFO - roject.impl.ProjectManagerImpl - Fatal error initializing plugin PythonCore
com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing plugin PythonCore
at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:271)
at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.handleInitComponentError(PlatformComponentManagerImpl.java:43)
at com.intellij.openapi.components.impl.ComponentManagerImpl.registerComponents(ComponentManagerImpl.java:399)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:95)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:89)
at com.intellij.openapi.project.impl.ProjectImpl.init(ProjectImpl.java:284)
at com.intellij.openapi.project.impl.ProjectManagerImpl.initProject(ProjectManagerImpl.java:289)
at com.intellij.openapi.project.impl.ProjectManagerImpl.newProject(ProjectManagerImpl.java:206)
at com.intellij.openapi.project.ex.ProjectManagerEx.createProject(ProjectManagerEx.java:74)
at com.intellij.ide.util.projectWizard.ProjectBuilder.createProject(ProjectBuilder.java:77)
at org.jetbrains.plugins.gradle.service.project.wizard.GradleModuleBuilder.createProject(GradleModuleBuilder.java:493)
at com.intellij.ide.impl.NewProjectUtil.doCreate(NewProjectUtil.java:110)
at com.intellij.ide.impl.NewProjectUtil.createFromWizard(NewProjectUtil.java:76)
at com.intellij.ide.impl.NewProjectUtil.createNewProject(NewProjectUtil.java:71)
at com.intellij.ide.actions.NewProjectAction.actionPerformed(NewProjectAction.java:36)
at com.intellij.ui.components.labels.ActionLink$1.linkSelected(ActionLink.java:67)
at com.intellij.ui.components.labels.LinkLabel.doClick(LinkLabel.java:156)
at com.intellij.ui.components.labels.ActionLink.doClick(ActionLink.java:80)
at com.intellij.ui.components.labels.LinkLabel$MyMouseHandler.mouseReleased(LinkLabel.java:352)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:646)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: com.intellij.diagnostic.PluginException: Key class org.jetbrains.plugins.ipnb.configuration.IpnbConnectionManager duplicated [Plugin: PythonCore]
... 53 more
Caused by: org.picocontainer.defaults.DuplicateComponentKeyRegistrationException: Key class org.jetbrains.plugins.ipnb.configuration.IpnbConnectionManager duplicated
at com.intellij.util.pico.DefaultPicoContainer.registerComponent(DefaultPicoContainer.java:136)
at com.intellij.openapi.components.impl.ComponentManagerImpl.registerComponents(ComponentManagerImpl.java:395)
... 50 more

Then, when the separate instance of IntelliJ starts, if I try to create a new project, I can page through the dialogs, but get this error:

I'm sort of at a loss for what's wrong. Things I've tried:

1. Updating my JDK to the latest version of Java 1.8 (update 151)

2. Cleaning out and rebuilding the Community Project

3. Removing the out/ directory in the project and running debug again.

4. Checking out a current production release of IDEA Community edition and rebuilding it (git checkout idea/173.3727.127).

This is the code I'm using for my dummy project: https://bitbucket.org/jonnycarteradaptavist/dummy-idea-plugin

Anyone got some pointers on where I've gone wrong, or what I might try?

0

As a follow-up, I was able to at least test my sample action by disabling the Python plugin in the dummy local instance of IDEA, then open a file in the debugging instance of IntelliJ. My action is registered and works as expected, so I'm pretty sure that this is an environment problem, rather than a code problem.

0

Hi, 

what versions of IntelliJ IDEA and Python plugin are used as a Plugin Sdk?

How do you add python plugin to the Sdk? Do you import settings on the application start or install plugin manually?

If you need python for your plugin it's easier to use PyCharm as a home directory for the Plugin Sdk.

 

0

That's the thing, I don't need Python at all, and I didn't deliberately install it. I just cloned the IntelliJ Community Edition source as described in the docs and setup the development environment as instructed. As near as I can tell, the Python plugins were enabled by default and broke the experience.

0

Please, go to the Project Structure->SDKs->Choose plugin sdk and see "Sandbox Home" folder.

Remove this folder completely, next time you use Run configuration you'll see this dialog 

Do not import settings and python plugin will not be enabled.

1

Thanks! That is quite helpful and you are right. I did get a warning when I removed the Sandbox Home folder path that it was invalid, but IDEA still let me save the setting. That done, my debug configuration worked just fine. I did get a new error while trying to create a Gradle project (see below), but it built a vanilla Java command line application for me without any fuss.

2017-12-11 09:19:46,764 [ 124162]  ERROR - tartup.impl.StartupManagerImpl - java.lang.NoClassDefFoundError: org/gradle/tooling/model/Model 
java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/gradle/tooling/model/Model
    at org.jetbrains.plugins.gradle.service.project.data.ExternalProjectDataCache.<init>(ExternalProjectDataCache.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:103)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:80)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:63)
    at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.getComponentInstance(ServiceManagerImpl.java:220)
    at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:239)
    at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:206)
    at com.intellij.openapi.components.ServiceManager.doGetService(ServiceManager.java:49)
    at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:43)
    at org.jetbrains.plugins.gradle.service.project.data.ExternalProjectDataCache.getInstance(ExternalProjectDataCache.java:50)
    at org.jetbrains.plugins.gradle.config.GradleResourceCompilerConfigurationGenerator.<init>(GradleResourceCompilerConfigurationGenerator.java:80)
    at org.jetbrains.plugins.gradle.service.project.GradleStartupActivity.runActivity(GradleStartupActivity.java:66)
    at com.intellij.ide.startup.impl.StartupManagerImpl.runAndMeasure(StartupManagerImpl.java:176)
    at com.intellij.ide.startup.impl.StartupManagerImpl.logActivityDuration(StartupManagerImpl.java:162)
    at com.intellij.ide.startup.impl.StartupManagerImpl.lambda$runPostStartupActivitiesFromExtensions$1(StartupManagerImpl.java:150)
    at com.intellij.ide.startup.impl.StartupManagerImpl.runActivity(StartupManagerImpl.java:367)
    at com.intellij.ide.startup.impl.StartupManagerImpl.lambda$queueSmartModeActivity$2(StartupManagerImpl.java:182)
    at com.intellij.openapi.project.DumbServiceImpl.updateFinished(DumbServiceImpl.java:299)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$pollQueueLater$0(TransactionGuardImpl.java:74)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
    at java.awt.event.InvocationEvent.dispatch$$$capture(InvocationEvent.java:311)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:650)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NoClassDefFoundError: org/gradle/tooling/model/Model
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
    at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:276)
    at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:272)
    at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:226)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 45 more
Caused by: java.lang.ClassNotFoundException: org.gradle.tooling.model.Model
    at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:222)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 53 more
2017-12-11 09:19:46,767 [ 124165]  ERROR - tartup.impl.StartupManagerImpl - IntelliJ IDEA 2017.3  Build #IC-173.SNAPSHOT
2017-12-11 09:19:46,767 [ 124165]  ERROR - tartup.impl.StartupManagerImpl - JDK: 1.8.0_151
2017-12-11 09:19:46,767 [ 124165]  ERROR - tartup.impl.StartupManagerImpl - VM: Java HotSpot(TM) 64-Bit Server VM
2017-12-11 09:19:46,767 [ 124165]  ERROR - tartup.impl.StartupManagerImpl - Vendor: Oracle Corporation
2017-12-11 09:19:46,767 [ 124165]  ERROR - tartup.impl.StartupManagerImpl - OS: Mac OS X
2017-12-11 09:19:46,767 [ 124165]  ERROR - tartup.impl.StartupManagerImpl - Last Action:

Looks like removing the sandbox home removed access to the gradle plugin classes.

I'm not too worried about it at this point; my environment works well enough for my purposes. That said, the docs on setting up a development environment could probably use a review & run through on a fresh machine.

0

请先登录再写评论。