使导入的JAR文件取决于项目中的其他依赖性,而不是制作自己的依赖性

发布于 2025-01-27 19:29:12 字数 768 浏览 2 评论 0原文

我有Intellij Project一个具有导入的外部JAR文件(由项目B,JAR文件和其他一些开发人员制成的Gradle设置),看起来像这样:

​我由项目B制成的不同罐子(在其中修改了一些代码)。

Project B的主模块看起来像这样:

并将jar导入项目A中,它像这样出现的文件夹要多得多,而不是com:

“在此处输入图像描述”

我猜这是因为项目B有一个许多其他依赖项取决于,因此当它制作该罐子文件时,需要包含其他文件夹才能依靠。问题是,项目A中的许多依赖项都包含在A中。有人知道如何制作它,因此JAR文件仅看起来像在顶部发布的第一张图片,并且取决于项目A中已经包含的其他依赖关系?

I have intelliJ project A that has an imported external jar file (made from project B, jar file and gradle setup made by some other dev) that looks like this:

enter image description here

I want to replace that jar with a different jar I made from project B (where I modified some code).

Project B's main module looks like this:

enter image description here

Then when I make a jar file for it selecting main as the module (I don't select a class):
enter image description here

And import the jar into project A, it comes out like this with a lot more folders than just the com:

enter image description here

I'm guessing this is because Project B has a lot of other dependencies that it depends on so when it makes that jar file it needs to include those other folders for it to rely on. The thing is, a lot of those dependencies are included in project A. Does anyone know how to make it so the jar file only looks like the first picture posted at the top and it depends on the other dependencies already included in project A?

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

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

发布评论

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

评论(1

将军与妓 2025-02-03 19:29:12

实际上,jar文件只是zip文件的另一个名称(加上可选的清单文件)。您需要做的就是将.class文件从项目B中放入zip文件(在正确的目录/IES中),然后将扩展名更改为.jar

A JAR file is in reality just a different name for a ZIP file (plus an optional manifest file). All you need to do is put your .class files from Project B in a zip file (in the right directory/ies) and then change the extension to .jar

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