没有工作解决方案的Java传递依赖问题

编程入门 行业动态 更新时间:2024-10-26 07:32:29
本文介绍了没有工作解决方案的Java传递依赖问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Maven来管理我的项目依赖项。我的依赖树在包B上有冲突,如:

I am using Maven to manage my project dependencies. My dependency tree has a conflict on package B like like:

A -> B (v1.4) C -> B (v1.5)

事实证明包 A 依赖于在v1.5中修复的错误,而包 C 需要1.5中不在1.4的功能。

It turns out that package A depended on a bug that was fixed in v1.5, and package C requires functionality from 1.5 that was not in 1.4.

具有大量依赖关系的大型Java项目如何管理这些类型的问题?即使包装A似乎在v1.5的表面层面上工作,我仍然觉得在所有边缘情况下假设它将像以前一样工作会有风险。

How do large java projects with tons of dependencies manage these types of issues? Even if package A appeared to work on a surface level with v1.5, I still feel like it would be risky to assume in all edge cases it will work as it did before.

请注意,这是一种假设情况,因此无需知道这些代码包含哪些包。

Note that this is a hypothetical situation, so it is not necessary to know which packages these represent.

推荐答案

只有Maven和经典的罐子,没有任何结果:这就是为什么我们称之为依赖地狱(dll地狱是原始的,请注意押韵:

With just Maven and classic jars, there is no resulution: that's why we call it the "dependency hell" ("dll hell" was the original, note the rhyme :)

然而, 是一种致力于解决这个问题的技术:OSGi。通过大规模复杂和复杂的类加载器杂耍,OSGi设法满足每个包的特定依赖要求。 Bundle A可以使用Bundle B v1.4,同时Bundle C可以使用B v1.5。

There is, however, a technology devoted to solving precisely this issue: OSGi. Through massively complex and convoluted classloader juggling, OSGi manages to satisfy each bundle's particular dependency requirement. Bundle A can use Bundle B v1.4, while at the same time Bundle C can use B v1.5.

OSGi已经存在了十多年了,它似乎既不茁壮成长也不会消亡;相反,它正在以冰川的速度获得采用,因此越来越多的JAR升级到OSGi捆绑包。

OSGi has been around for more than a decade now, it seems to neither thrive nor die out; rather it is gaining adoption at a glacial pace, so ever more JARs get upgraded to OSGi bundles.

更多推荐

没有工作解决方案的Java传递依赖问题

本文发布于:2023-11-15 23:59:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1599129.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   工作   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!