我可以更新 Eclipse 插件项目吗?它只是一个 jar 的包装器?

发布于 2024-09-27 09:30:45 字数 575 浏览 1 评论 0原文

问候, 我有一个java项目,我将其导出为jar。这个java项目也使用了JNI。 到目前为止,我能找到在 Eclipse 插件中使用此 jar 的唯一方法是将其包装在另一个 eclipse 插件项目中,并将此 jar 包装器插件添加到我的实际插件的依赖项中。 我已经与 Eclipse 的路径和依赖项设置搏斗了好几天,这种方法是目前唯一适合我的方法。 然而,这不是很实用,因为当我更改基于 JNI 的 java 代码时,我可以简单地创建一个新的 jar,但为了将该 jar 连接到我的实际插件,我每次都必须重新创建 jar 包装器插件。 也就是说,我删除了 jar 包装器插件项目,以及磁盘上的所有内容,并使用相同的名称重新创建它,指向更新的 jar。我还必须从实际的插件项目中删除对该项目的引用并再次添加(也许这最近变得更聪明,但我没有测试它)

这很耗时,而且我无法将这个包装器插件项目添加到 svn要么,因为它每次都是从头开始创建的。

如果我可以简单地通过指向新版本的 jar 来更新 jar 包装 eclipse 插件项目,那就可以解决我的问题,并且我可以在每次更新后将项目提交到 svn。

您能想到什么方法可以帮助我顺利地运行这个过程吗?

此致 塞雷夫

Greetings,
I have a java project which I export as a jar. This java project also uses JNI.
So far, the only method I could find to use this jar in an Eclipse plugin is to wrap it in an other eclipse plugin project, and add this jar wrapper plugin to dependencies of my actual plugin.
I've wrestled with Eclipse's paths and dependency settings for days, and this method is the only one that works for me at the moment.
However, it is not very practical, since when I change my JNI based java code, I can simply create a new jar, but to connect that jar to my actual plugin, I have to re-create the jar wrapper plugin every time.
That is, I delete the jar wrapper plugin project, with everything on the disk, and re create it with the same name, pointing to the updated jar. I also have to drop the reference to this project from the actual plugin project and add again (maybe this has gotten smarter recently, but I did not test it)

This is time consuming, and I can't add this wrapper plugin project to svn either, since it is being created from scratch every time.

If I could simply update a jar wrapping eclipse plugin project by pointing at the new version of jar, that would solve my problem, and I could commit the project to svn after each update.

Is there any method you can think of which may help me run this process smoothly?

Best Regards
Seref

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界等同你 2024-10-04 09:30:45

在 OSGi 捆绑包中使用外部库而不物理包装它们的 Equinox-only(即非标准 OSGi)方法是通过引用捆绑:您仍然需要一个包装器插件,但它不包含包装的库本身,而是包含包清单的 Bundle-Classpath 标头的语法如下:

Bundle-Classpath: external:/path/to/your/lib.jar

在开发期间,这非常方便,并且节省了每当更新包装库时都必须重新创建包装器插件的工作。在部署期间,您要么必须将库与产品一起安装,要么使用传统的包装器插件(包含实际库的插件)。您还可以对 bith 用例使用相同的包装器插件,但将 Bundle-Classpathexternal:/stuff/lib.jar 更改为 libs/lib。 jar 取决于您是否要使用包装库或外部库。

(大部分内容来自《OSGi and Equinox - 创建高度模块化 Java 系统》一书,我不太喜欢这本书,但它仍然包含有关 Equinox(Eclipse 的 OSGi 实现)和 PDE 构建的有用内容系统。)

An Equinox-only (i.e. non-standard OSGi) method of using external libraries in an OSGi bundle without physically wrapping them is bundling by reference: you still need a wrapper plugin, but it does not contain the wrapped library itself but a reference in the bundle manifest's Bundle-Classpath header with a syntax like this:

Bundle-Classpath: external:/path/to/your/lib.jar

During development time, this is quite convenient and saves the effort of having to recreate the wrapper plugin whenever the wrapped library is updated. During deployment time, you'll either have to install the library along with the product or use a traditional wrapper plugin (one containing the actual library). You can also use the same wrapper plugin for bith use cases, but change the Bundle-Classpath from external:/stuff/lib.jar to libs/lib.jar dependent on whether you want to use the wrapped or the external library.

(Most of this comes from the book OSGi and Equinox - Creating Highly Modular Java Systems, which I don't really like, but which nevertheless contains useful stuff about Equinox (Eclipse's OSGi implementation) and the PDE build system.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文