eclipse,在一个可运行的 jar 中导出多个项目(使用共享的二进制目录)

发布于 2024-09-27 22:39:25 字数 242 浏览 1 评论 0原文

我有三个项目构建到相同的 /bin 目录和另一个项目(我们称之为 A),这是不必要的。 A 需要所有其他项目。当我将 A 导出为可运行的 JAR 时,三个项目中只有一个将其放入该 JAR 中。

我可以添加复制到 JAR 中的其他项目(构建到不同的目录)。当我从构建路径中删除三个项目中的第一个(按字母顺序)时,就会包含下一个。

有人知道如何让 eclipse 复制 JAR 中的所有项目而不放弃将这三个项目构建到相同的 /bin 目录吗?

I have three projects which are build to the same /bin directory and anoher projects (let's call it A) where this is not necessary. A requires all the other projects. When I export A as a runnable JAR, then only one of the three projects makes it into the JAR.

I can add other projects (build to different directories) which are copied into the JAR. When I remove the (alphabetic) first of the three project's from the buildpath then the next is included.

Has somebody an idea how to let eclipse copy ALL projects in the JAR without giving up that the three projects are build to the same /bin directory?

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

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

发布评论

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

评论(2

不爱素颜 2024-10-04 22:39:25

每个 Eclipse 项目都应该有自己的 bin/ 目录;否则你会得到奇怪的错误。要解决您的问题,请打开项目属性并将其他三个项目添加到“构建路径”中的 A -> “项目”。

然后 Eclipse 将合并所有项目的类路径。

要导出单个 JAR 文件中的所有类,只需在 JAR 导出器中选择所有项目的源文件夹即可。

Each Eclipse project should have their own bin/ directory; otherwise you will get strange errors. To solve your problem, open the project properties and add the other three projects to A in "Build Path" -> "Projects".

Eclipse will then merge the classpaths of all projects.

To export all the classes in a single JAR file, simply select the source folders of all projects in the JAR exporter.

蹲墙角沉默 2024-10-04 22:39:25

解决方法是从每个项目创建一个 JAR 并将它们包含到 A.

A workaround would be to create a JAR from each project and include these into A.

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