混合不同版本的Java库 [英] Mixing different versions of Java libraries

查看:105
本文介绍了混合不同版本的Java库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目使用具有自己的依赖关系的Java库(例如,Hadoop,Jetty)。我最终使用不同版本的相同依赖关系,如ant 1.4.5,1.4.6。我的项目可能要使用蚂蚁1.4.7。这是一个小例子,可以得到比较复杂的更大的依赖关系,如HTTP Commons。

My project uses Java libraries that have their own dependencies (Hadoop, Jetty for example). I end up with different versions of the same dependencies, like ant 1.4.5, 1.4.6. My project may want to use ant 1.4.7. This is a small example, can get more complicated with larger dependencies like HTTP Commons.

如何让所有的库和依赖项发挥好?有没有办法隔离每个库(Hadoop,Jetty),以便他们只使用它们的依赖关系?

How do I get all the libraries and dependencies to play nice? Is there a way to isolate each library (Hadoop, Jetty) so they only use their dependencies?

推荐答案

您可以选择管理所有这些都具有相关管理框架,如OSGI。看看Spring框架动态模块 http://www.springsource.org/osgi

You may choose to manage all of these with a depenency management framework - like OSGI. Take a look at the spring framework dynamic modules http://www.springsource.org/osgi

您还可以查看Eclipse实现OSGI的框架部分。看看这里 http://www.eclipse.org/osgi/

You can also take a look at the part of the framework where Eclipse implements OSGI. Take a look here http://www.eclipse.org/osgi/

简短的答案只是为了最低的共同点。记住,认可的目录是您的朋友 - 当涉及到管理冲突的依赖项时。

The short answer is just to go for the lowest common denominator. Remember that the 'endorsed' directory is your friend - when it comes to managing conflicting dependencies.

这篇关于混合不同版本的Java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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