阻止 NetBeans 项目将 JAR 复制到其 lib 目录中?

发布于 2024-11-29 04:52:39 字数 166 浏览 0 评论 0原文

我在 NetBeans 中有两个项目相互依赖,其中一个项目引用了另一个项目的 JAR。目前,它将它所依赖的所有 JAR 复制到 dist/lib 目录中,但我不希望它复制它们——我希望它直接从该 dist 目录引用其他项目的 JAR。

如何在不手动编辑类路径的情况下通过 NetBeans 执行此操作?

I have two projects in NetBeans that are dependent upon each other, and one references the JAR of the other one. Currently it copies all the JARs it is dependent upon into the dist/lib directory, but I don't want it to copy them--I want it to directly reference the other project's JAR from that dist directory.

How do I do this through NetBeans without manually editing the classpath?

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

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

发布评论

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

评论(2

终难愈 2024-12-06 04:52:39

您可能想考虑使用 Maven 为您的项目。它是一个工具,可以让您更好地控制构建过程并澄清项目的依赖关系。最新版本的 Netbeans 捆绑了 Maven 支持。

You might want to look into using Maven for your projects. It's a tool that gives you more control over the build process and clarifies your projects' dependencies. The latest versions of Netbeans come bundled with Maven support.

疧_╮線 2024-12-06 04:52:39

其实我觉得这是不可能的。项目之间的“连接”仅适用于 Netbeans 内部,而 dist 文件夹(正如其缩写所示)用于分发。

这意味着您应该能够简单地将 dist 文件夹的内容复制到其他任何地方,甚至其他机器,并且它应该按原样工作(假设安装了 Java,以及其他此类“微小”依赖项 )。

如果 dist 文件夹中的主 JAR 仅引用其他 dist 文件夹,您将无法在其他计算机上运行,​​除非您将其他 dist 文件夹复制到确切位置等,这根本不是一件好事要做或必须做。

因此,要么按照 MrDrews 的建议使用 Maven,要么必须接受 dist 中的库。

I actually think that this is not possible. The "connection" between projects is for within Netbeans only, while the dist folder is, as its abbreviation suggests, for distribution.

That means that you should be able to simply copy the contents of the dist folder anywhere else, even other machines, and it should work as is (provided there is Java installed, and other such "tiny" dependencies).

If the main JAR in your dist folder would just reference the other dist folder you would not be able to run in on some other machine, unless you would copy the other dist folder in the exact location, etc. which is simply not a good thing to do or to have to do.

So, either go with Maven as MrDrews suggested or accept the libs in dist as a must.

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