最好的 jar 组织策略是什么?

发布于 2025-01-06 12:57:05 字数 200 浏览 3 评论 0原文

如果我们正在构建一个大型的 java 类库,什么决定了何时最好将它们分割成单独的 jar 文件?

我的理解是,拥有一个大的 jar 文件不应显着影响 JVM 性能。然而,如果在对 jar 进行更改或添加时运行一整套冗长的测试,则会产生一些开发成本。在 maven 和 archiva 中使用大型 jar 文件是否有成本或好处?

人们在实践中使用什么策略?

If we are building a large library of java classes, what determines when it is best to split them into separate jar files?

My understanding is that having one large jar file should not significantly affect the JVM performance. However, there is some development cost if an entire suite of lengthy tests are run when changes or additions are made to the jar. Is there a cost or benefit when using large jar files with maven and archiva?

What strategy do people use in practice?

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

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

发布评论

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

评论(3

治碍 2025-01-13 12:57:05

仅考虑变更管理方面,其余的可以忽略不计。 Jar 文件决定了最小可释放单元。

Take into account change management aspects only, the rest is negligible. Jar file is something that determines minimum easily-releasable unit.

天涯离梦残月幽梦 2025-01-13 12:57:05

我们喜欢将罐子分成更小、更易于管理的单元。每个 jar 都专门用于执行一部分任务。当我们开发一个应用程序时,我们只会将其需要的罐子拉入其中,而不是一个包含所有内容的大罐子。

我们有用于安全性、UI、通用结构和界面、本地化以及许多其他特定于我们行业的东西的 jar。

We like to split our jars up into smaller, more manageable units. Each jar is specific for doing a subset of tasks. When we develop an application, we'll pull into it only the jars it needs, rather than one large jar that has everything.

We have jars for security, UI, general structures and interfaces, localization, and a bunch of other things that are specific for our industry.

£噩梦荏苒 2025-01-13 12:57:05

jar项目在逻辑上是分开的,没有循环依赖,一层只依赖于前面的层。

由于您可以(除了项目名称)给出 IDE 中列出的描述性名称,保持项目有序的一种方法是使用缩写和数字前缀:

  • CD01 baselib
  • CD10 mathlib
  • CD30 daolib
  • CD91 xysite

Logically separate layers of jar projects, without cyclic dependencies, one layer only depending on preceding layers.

As you can (besides the project name) give a descriptive name being listed in the IDE, one way to keep projects ordered is with abbreviation and numeric prefix:

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