没有工作解决方案的Java传递依赖问题 [英] Java transitive dependency issue with no working resolution

查看:128
本文介绍了没有工作解决方案的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传递依赖问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆