简体   繁体   English

如何在 java 项目中使用省略的库

[英]How to use ommited library in java project

I have two libraries as dependencies in my project.我的项目中有两个库作为依赖项。 Each of those two libraries has bunch of libraries as dependency.这两个库中的每一个都有一堆库作为依赖项。 However there are two same named libraries with different version, and one of them as I can see in maven pom dependency hierarchy is ommited conflicting with same named one.但是,有两个具有不同版本的同名库,正如我在 maven pom 依赖层次结构中看到的那样,其中一个与同名库冲突。 When I run program program it uses elements of both "parent" libs, but it uses one of conflicting "child" libs whit which it tries to work with "parent" lib which should use other conflicting lib.当我运行程序程序时,它使用两个“父”库的元素,但它使用冲突的“子”库之一,它试图与“父”库一起使用应该使用其他冲突的库。 So is it possible to have both conflicting libs used in project.那么是否有可能在项目中使用两个冲突的库。

Thanks谢谢

Not really.并不真地。

You can use the Maven shade plugin to construct a shaded jar that contains the dependency with a different package hierarchy.您可以使用 Maven 阴影插件来构造一个阴影 jar ,其中包含具有不同 package 层次结构的依赖项。

But the usual solution is to try to find a version of the library that works with all of the other stuff (not always possible, I know).但是通常的解决方案是尝试找到一个可以与所有其他东西一起使用的库版本(我知道,这并不总是可能的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM