简体   繁体   中英

Eclipse Plugin Dev: Unable to resolve dependencies

Based on this simple tutorial , I am trying to display pop-ups notifications, as part of the org.eclipse.mylyn.commons.ui dependency. So I have added this dependency to my plugin.xml as such:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Roll and Scroll Recorder
Bundle-SymbolicName: ATF_Recorder_Plugin;singleton:=true
Bundle-Version: 0.0.502
Bundle-Activator: com.jcraft.eclipse.jcterm.JCTermPlugin
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 com.jcraft.jsch;bundle-version="0.1.31",
 org.eclipse.core.resources;bundle-version="3.7.101",
 org.eclipse.jsch.core;bundle-version="1.1.300",
 com.jcraft.eclipse.jsch.core,
 org.eclipse.mylyn.commons.ui;bundle-version="3.6.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: OSEHRA

Additionally I clicked compute dependencies within my Feature project and now have this updated into my feature.xml file:

<requires>
  <import plugin="org.eclipse.ui"/>
  <import plugin="org.eclipse.core.runtime"/>
  <import plugin="com.jcraft.jsch" version="0.1.31" match="greaterOrEqual"/>
  <import plugin="org.eclipse.core.resources" version="3.7.101" match="greaterOrEqual"/>
  <import plugin="org.eclipse.jsch.core" version="1.1.300" match="greaterOrEqual"/>
  <import plugin="com.jcraft.eclipse.jsch.core"/>
  <import plugin="org.eclipse.mylyn.commons.ui" version="3.6.1" match="greaterOrEqual"/>
</requires>

However when I installed my custom plugin, and go to show it's view, the dependency is never being resolved:

java.lang.ClassNotFoundException: org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.jcraft.eclipse.jcterm.JCTermView.createPartControl(JCTermView.java:189)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
...

And the lesson from this question is

Don't ever use non-API classes, unless you don't care if your plug-in breaks in future versions .

I guess you have to build your plug-in twice, if you absolutely need backward compatibility.

But, since

  • you are targeting Indigo (3.7)
  • the bug, in the context of which the provisional packages became API, is Bug 360301
  • this bug fix was included in Mylyn 3.7

you are probably best of requiring org.eclipse.mylyn.commons.ui , version 3.7 and later.

Since you are using Eclipse 3.6 for development, you will have to set up a target platform including a 3.7 installation.

Are you sure you're running the plugin against the same version of mylyn that you built against? In newer versions of mylyn (3.8.0 for example) that class has been moved to package org.eclipse.mylyn.commons.ui.dialog .

Issue: Even though the "same" Indigo SR 2 version of Eclipse is being used, they are not equal. Some of them have 3.6 version of org.eclipse.mylyn.commons.ui other have 3.8 (which is supposed to be in Juno only...).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM