下游插件可以使用外部化的plugin.xml 字符串吗?
如果我有通用插件,则插件 A 和 B 作为单独的插件/产品,两者都取决于通用插件。
在插件通用中,我将plugin.xml中的字符串外部化,这给了我%bundle-vendor =“我的公司名称”。
在下游插件 A 和 B 中,我可以使用供应商的通用捆绑供应商属性吗?我尝试在前面添加通用插件 ID,但它不起作用。这应该可能吗?
If I have plugin common, with plugin A and B as separate plugins/products, both depending on plugin common.
In plugin common, I externalise the strings in plugin.xml, this gives me %bundle-vendor = "My Company Name".
In downstream plugins A and B, can I use the common bundle-vendor property for vendor. I tried prepending the common plugin id but it didn't work. Should this be possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我记得,plugin.properties 在插件外部不可用。但是,您可以定义属性类型(扩展 org.eclipse.osgi.util.NLS)来自动加载属性文件并将其公开给其他插件。
该类型中的每个静态字符串属性都将根据 NLS 规则从属性文件中进行处理并使其可用。
这是一个简单的示例,它将在加载类时加载属性文件并填充静态变量 some_property 和 some_other_property。
As far as I recall the plugin.properties are not available outside the plugin. However you can define a properties type (extending org.eclipse.osgi.util.NLS) to automagically load the properties file and expose them to other plugins.
Each static String property in the type will be processed from the property file(s) according to NLS rules and made available.
Here is a trivial example that will load the properties file and populate the static variables some_property and some_other_property when the class is loaded.
很好的答案丰富。我唯一要添加的是确保您在捆绑包清单中公开包/类,以确保其他捆绑包可以访问它。
Great answer Rich. The only thing I'd add is to ensure that you expose the package/class in the bundle manifest to ensure other bundles can access it.