简体   繁体   English

如何在各种eclipse插件之间共享依赖JAR?

[英]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. 我有插件A和插件B,它们都使用xyz.jar文件作为依赖项。 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. 我不想在两个插件中都放置依赖项,因为在运行时加载两个JAR副本并不理想,它可能会产生冲突,并且会增加大小。

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. 因此,我尝试创建插件C,在其中放置了所有依赖性,并且为插件A和B添加了插件C作为必需的插件。 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? 我已经从插件C导出了程序包,但我无法将其导入到插件A或B中,所以是否有其他方法可以在多个项目之间共享单个依赖项jar?

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. 因此,我尝试创建插件C,在其中放置了所有依赖性,并且为插件A和B添加了插件C作为必需的插件。

This is the correct approach. 这是正确的方法。

I have exported package from plugin C which I am not able to import in plugin A or B 我已经从插件C导出了程序包,但无法在插件A或B中导入

Then you probably did something wrong when creating C, but you don't provide enough information to tell what. 这样一来,在创建C时您可能做错了什么,但是您没有提供足够的信息来说明什么。

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? 您应该首先检查xyz.jar是否已经是OSGi捆绑软件:它的MANIFEST.MF文件中是否有Bundle-SymbolicNameBundle-Version等? Or if it is open-source, there may already be a wrapping bundle in eg SpringSource Bundle Repository . 或者,如果它是开源的,则可能在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. 如果两者都不是,请参阅http://bnd.bndtools.org/chapters/390-wrapping.htmlhttp://enroute.osgi.org/tutorial_wrap/050-start以获得有关如何正确创建捆绑包的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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