0

So here is my struggle..I am working on my first Eclipse Plugin.. On my PC, I have 2 eclipse versions, one where I developed the plugin, and another where I want to install the plugin.

Now my plugin works just fine, as I can easily test it by running it as a Eclipse Application using the eclipse that the plugin was developed in. This is how my plugin looks:

enter image description here

As you can see, I have quite a lot of so called "Plug-in Dependencies".

I also tried various ways to export the plugin, the latest (and by some other answers best way) approach is using this tutorial : http://www.vogella.com/tutorials/EclipsePlugin/article.html#install-feature-via-the-eclipse-update-manager

Points :

  1. Exercise: Create a feature for your plug-in
  2. Exercise: Create an update site your plug-in

However, after successfully installing it (it appears as a plugin in the "Installation Details") in the second Eclipse, the functionality is not the one expected(the one that I get when I test the plugin in the Eclipse used to develop it).

I have a hunch that the problem is with that list of dependencies from the first pic.. Because what gets exported is like ~14 KB, while some of the jars from the dependency list have more than 150 KB.. I searched in the installation Eclipse folder for some of those jars but couldn't find them..

What am I doing wrong?..What suggestions do you have for including those dependencies in the plugin export..

Thanks Dan

UPDATE 1 After exporting my Plugin, it looks similar to the folder structure from the second answer from here : How to install plugin for Eclipse from .zip But I think that there is a problem because in the "features" and "plugins" folder, I only have the jar for my plugin, and none of the dependencies (in the answer for the other question, there were a lot of Microsoft jars in those folders)

SOLUTION The problem was that I wasn't setting the dependencies in the Feature that I was exporting. This can be done by going into the Dependecies tab while editing the feature.xml feature file, and adding there the dependencies that you plugin needs (which are listed under Plugin Dependencies in the ecliplse project)

Community
  • 1
  • 1
Teshte
  • 624
  • 1
  • 7
  • 26

2 Answers2

1

Those appear to all be standard Eclipse plugins, they don't need to be part of your export.

The plugin install will find and use the already installed plugins.

You would get an error from the install if there were missing dependencies.

If you think that the target Eclipse is not going to have some of the plugins you need create a Feature and list the required plugins or better still the required Eclipse features that you require. Use the Feature export rather than plugin export to export this. When you install this the installer will find the necessary plugins/features from the correct install sites.

What you never do is include standard plugins in your export because this can lead to version mismatches.

For example, this is feature.xml extract:

<feature
      id="greg.music.feature"
      label="Feature"
      version="1.0.0.qualifier"
      provider-name="Greg">

   <requires>
      <import feature="org.eclipse.e4.rcp" version="1.4.1.v20160212-1350" match="greaterOrEqual"/>
   </requires>

   <plugin
         id="greg.music.e4.rcp"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

says that the feature requires the Eclipse org.eclipse.e4.rcp feature. The feature includes the greg.music.e4.rcp plugin.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • I was thinking about those "Standard Eclipse plugins"..but thing is that as I mentioned in my first post, I have 2 eclipses on my PC. One used for the plugin development (which has jars necessary for this task), and the other Eclipse where it seems like I don't have them. Another possibility could be that I didn't specify correctly my dependencies during plugin development..Do you have knowledge about plugin dependencies? – Teshte Nov 08 '16 at 15:10
  • It really is not clear what you are saying the problem is here. Either the plugin installs correctly and finds all the dependencies or you get an error saying that some dependencies cannot be found. You can create a feature listing other standard Eclipse features that you need but you would **never** package standard Eclipse plugins as part of your export. – greg-449 Nov 08 '16 at 15:28
  • I am saying that maybe when I run my plugin from the Eclipse where I developed it, it works because I have the dependencies on the class path.. And since it is possible that I didn't specify the dependencies correctly when I export the Plugin, it exports just my code, and none of the needed dependencies, and so this is causing it to not work (this would explain why the installation of the Plugin works without any problems..). What do you mean by `would never package standard Eclipse plugins as part of your export` ? – Teshte Nov 09 '16 at 08:32
  • I mean exactly that. You do not include plugins that are part of Eclipse in your export. You use a feature and say which Eclipse plugins / features you require so that the installer can find the correct versions. – greg-449 Nov 09 '16 at 08:36
  • When you say `feature` you mean to use this approach `You create a feature project via File ▸ New ▸ Other…​ ▸ Plug-in Development ▸ Feature Project.` ? – Teshte Nov 09 '16 at 08:41
  • Yes, the tutorial you reference creates one in section 9.1 – greg-449 Nov 09 '16 at 08:48
  • So you are saying that i should add all the jars from the `Plug-in Dependencies` from the pic above inthe feature.xml using this approach ` ` ? – Teshte Nov 09 '16 at 08:49
  • That is what I said in the answer and that is what I mean. – greg-449 Nov 09 '16 at 09:06
1

Your screenshot doesn't look like a "plug-in" at all. It looks more like an Eclipse 3.x RCP application. You have classes like Application and ApplicationActionBarAdvisor. This is why you see a difference in behaviour when you install your plug-in into Eclipse and launch it. When you are developing your code and launching your "plug-in", you are probably actually launching it as a standalone RCP application.

Nonetheless, your "application" should still run (to an extent depending on how it's coded) as I see you have a view and a perspective defined. Have you tried opening your view or your perspective in the Eclipse where you installed your plug-in?

rcjsuen
  • 873
  • 1
  • 6
  • 12
  • So, I don't have plugin dev experience, so I followed 2 tutorials http://www.ibm.com/developerworks/library/os-eclipse-plugindev1/index.html (this is for how to create a plugin in genereal) and a second one http://stackoverflow.com/questions/12956666/creating-a-eclipse-plugin-with-text-hover (which is similar to what I am doing..I need just some hover text when hovering over text in the Java Editor). When the plugin works, i run it from the development Eclipse with `Run as -> Eclipse Application`. In the Eclipse where I install it, the hover doesn't display the correct information.. – Teshte Nov 09 '16 at 08:28