views:

657

answers:

7

Right now, I am trying to create a plug-in of Eclipse which depends on other jar; therefore, I created a plug-in base on the jar and deployed it under my Eclipses' plugin foler. It works well when I start it from my working environment via an Eclipse. However, as soon as I have exported it into a jar and have deployed into Eclipse, it not work any more as it couldn't find out the dependent jar. What happened and how to solve the issue? Does anyone know that? please save me.

A: 

The working behavior out of Eclipse is normal, since the dependent jar is in the classpath of the project.

Have you had a look at the plugin folder you deployed? I suspect, that the dependency isn't contained in the plugin folder.

boutta
+2  A: 

The MANIFEST.MF has a Tab called "Dependencies" in which alle plugins should placed the current plugin depends on. At runtime you have to place the "dependencies" plugins in the same folder as the one you want to start or you want to work with.

When a plugin has jars it should use, you have to put the jars to the "Runtime" Classpath Entry and you should add the jar to the "Build" Binary Build entry.

Markus Lausberg
+1  A: 

Also, does the plugin.xml associated with your 'external jar' plugin does export the right packages ?

Did you check this article describing all steps necessary to packaging 3rd party jars as plug-ins ?

Other very important points are described in the article PDE and 3rdParty Bundles in OSGI Enterprise apps with rules such as:

  • Always put dependent JAR Files in separate bundles and describe the dependencies in your Manifest file. Don't hide those JARs in your own bundle.

  • If possible use Import-Package to resolve your dependencies.

  • Export only your "public" packages - no internal.

  • Use Require-Bundle only to resolve dependencies inside your own „universe“, not against common bundles.

  • Always version Require-Bundle, Import-Package und Export-Package.
    Require-Bundle always has a dependency to a bundle with a specific name.
    Import-Package isn't dependent from the name of the bundle, so its more flexible. Of course its more work to look at your packages and decide which you need to import or to export compared to a one-liner with Require-Bundle

  • If a bundle itself contains packages inside the bundle and exports them, never put these packages also into the Manifest as imported packages.

  • Before deploying of a bundle as plug-in be sure the Package-Uses are re-calculated. Wrong Package-Use entries for exported packages can stop PDE to export your Plug-In.

VonC
A: 

I have deployed two plug-ins into a clean-Eclipse to verify it. One is I am working for and another one is the dependent one. I did may not check the Dependencies in runtime through the plug.xml. Let me go through with your kindly comments

Thanks, I'll let you know ASAP

moses
A: 

I just had a similar problem. I fixed it using the plugin view:

  1. Add jar using the Classpath section of the Runtime tab
  2. Use the Organise Manifest Wizard from the Overview tab to do all the required manifest changes
  3. Use the Export Wizard from the Overview tab to export the finished plugin.

Note I am using Eclipse 3.3 so your milage may vary.

Michael Rutherfurd
A: 

Thanks VonC. Let me interpret what I am doing to let everyone help me out. I trying to create a plugin which invokes Ant to executing specific targets that has been integrated with IVY a dependence resolve framework. So far, I can execute target properly, if I only start an instance from my working Eclipse, but if I export it into a jar, it couldn't find out the dependence in Ant. BTW, does any one how to generate a plug-in like Ant, in Eclipse, it contains several folders such lib, bin etc..

moses
A: 

Hi every body. I installed my plug-ins to plug-in folder of eclipse. but i didn't find that plug-in in plug-in list(help menu->about eclipse->plug-ins details). I believe that some dependent plug-in is missing. can anybody tell me that what is the procedure to find out the missing dependent plug-ins.( I know one procedure that is in runconfiguration create new eclipse configuration in plugin tab select validate plugins but i want another way).thanks in advance