简体   繁体   中英

How to load an eclipse plug-in

I have recently developed an Eclipse plugin, however the plugin does not seem to load in Eclipse (3.4.2). If I go to

Help > About Eclipse Platform > Configuration Details

I see the pluging listed

file:/C:/Program Files/eclipse/ganymede/plugins/de.vogella.plugin.htmlconverter_1.0.0.jar

However it does not seem to work. I know the plugin has been implemented correctly as if I right click on the project ( de.vogella.plugin.htmlconverter ) and select Run Eclipse Application then a new Eclipse is launched and the popup menu that has been implemented works. So why does it not work when I export the project from Eclipse and place it in the plugins directory.

I have tried this on both Windows XP and Mac OS X to no avail, if I inspect the JAR I see all the required artifacts.

META-INF/
META-INF/MANIFEST.MF
de/
de/vogella/
de/vogella/plugin/
de/vogella/plugin/htmlconverter/
de/vogella/plugin/htmlconverter/handler/
src/
src/de/
src/de/vogella/
src/de/vogella/plugin/
src/de/vogella/plugin/htmlconverter/
src/de/vogella/plugin/htmlconverter/handler/
de/vogella/plugin/htmlconverter/Activator.class
de/vogella/plugin/htmlconverter/handler/Convert.class
plugin.xml

My MANIFEST.MF also looks like this

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Htmlconverter Plug-in
Bundle-SymbolicName: de.vogella.plugin.htmlconverter;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: de.vogella.plugin.htmlconverter.Activator
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.eclipse.co
 re.resources;bundle-version="3.4.0",org.eclipse.jdt.core;bundle-versi
 on="3.4.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: de.vogella.plugin.htmlconverter;uses:="org.osgi.framew
 ork,org.eclipse.ui.plugin",de.vogella.plugin.htmlconverter.handler;us
 es:="org.eclipse.core.commands,org.eclipse.core.resources,org.eclipse
 .core.runtime"

I have tried lazy activation and eager activation, but still nothing. Whats really confusing is that it works when I debug and launch a separate Eclipse application. Any ideas what I am doing wrong.
Are there other Eclipse plugins out there that can perform some form of diagnostics and tell me what is wrong.

Final point, if I look at the Eclipse error log I see no errors. However, if I edit the MANIFEST.MF and put in some rubbish strings, it reports and error validating the MANIFEST.MF so I know Eclipse sees the plugin

Can anyone help?

Sounds like you are using my tutorial: http://www.vogella.de/articles/EclipsePlugIn/article.html

The installation medium p2 has been enhanced between 3.4 and 3.5. This may explain the difference in the behavior. It sounds like you have the option to use Eclipse 3.5. I strongly recommend to use 3.5 as p2 in 3.4 was the very first version of p2 which replaced the old update manager.

From eclipse3.4, you have a new directory dropins within your eclipse installation.
See Eclipse p2

替代文字
(source: jroller.com )

Try to copy the plugin there.

Check also, as illustrated by this thread , you didn't define your own config.ini .

when I changed this to ' Generate a default config.ini file ' and refreshed it, it worked fine.


The OP ng adds:

Well it worked in 3.5, but why not 3.4.x??

p2 has been introduced late in the 3.4 development lifecycle (3.4M6), and was quite buggy at first.
The 3.5 version of p2 is considered much more stable.

It has prompted bugs like " Re-enable old Update Manager in 3.4.0 and disable p2 as update engine/UI ", because (extract from the bug report):

  • p2 was made public unusually late in the Eclipse development cycle (M6). Community had no chance to extensively test such a central feature.
  • The list of opened bugs for p2 is extremely large for such a big and late platform change

( more then 4000 , most of them closed for the 3.5 release, but still...)

So if you can use eclipse3.5, that would be better for working p2 features.


ng adds:

but there has got to be a way to install plugins in 3.4.x,

You can try and copy your plugin in a shared plugin directory , which should be able to interpret both pre-p2 and p2 format.
That common external directory would be referenced through (for 3.4):

[eclipse]\links\myplugins.link file
content:
path=C:/my/eclipse/plugins

(For 3.5, you would use a eclipse.ini setting , as in this eclipse.ini )

Try to copy your plugin respecting a directory structure similar to the one I used for a ClearCase plugin :

 myPlugins
   my.plugin.x.y.z
     eclipse
       features 
          ...
       plugins
          ...

If your jar already respect the my.plugin.xyz structure shown above, you could just copy the jar in the myPlugins directory. (both approach can be tried here)

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