简体   繁体   中英

How to share dependency JAR among various eclipse plug-ins?

I have plugin A and plugin B, both are using xyz.jar file as dependency. I don't want to put the dependency in both plugin, because which is not ideal to have two copies of the JAR are loaded at runtime and it may create conflicts as well and as well as it increase the size.

So I have tried to create plugin C in which I have put all the dependency and for plugin A and B added plugin C as a required plugin. But here I am facing problem of export/import package.

I have exported package from plugin C which I am not able to import in plugin A or B, so is there any alternate way to share single dependency jar among multiple projects?

So I have tried to create plugin C in which I have put all the dependency and for plugin A and B added plugin C as a required plugin.

This is the correct approach.

I have exported package from plugin C which I am not able to import in plugin A or B

Then you probably did something wrong when creating C, but you don't provide enough information to tell what.

You should start by checking if xyz.jar is already an OSGi bundle: does it have Bundle-SymbolicName , Bundle-Version etc. in its MANIFEST.MF file? Or if it is open-source, there may already be a wrapping bundle in eg SpringSource Bundle Repository . In these cases you can use it as a plugin dependency directly.

If neither, see http://bnd.bndtools.org/chapters/390-wrapping.html or http://enroute.osgi.org/tutorial_wrap/050-start for an explanation how to create a bundle correctly.

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