Maven使用错误库中的类
我目前正在研究一个Maven项目,其中包括很多外部库。现在我有以下问题...
问题:我有两个不同的库(假设 library a&amp; library b )都有一个类(让我们命名类< Strong> ABC.Class )具有相同的className,但类别没有相同的实现!现在,我的测试班之一使用 abc.class 来自库a ,这是错误的类/库。该测试级应使用 abc.class 来自库B 。我不能仅删除库a,因为我也需要其他测试级。
我的设置:
- maven:apache-maven-3.6.1
- java:jdk11
- IDE:Intellij
我的问题:有没有办法为特定类别固定奇异库?因此,我可以将库b 固定到失败的测试阶级,因此它可以使用正确的库和正确的实现来实现 abc.class 。
在最好的情况下,我想在POM中修复它:)
请让我知道是否有可能。
i am currently working on a Maven project with alot external Libraries. Now i have following Issue...
Issue: I have two different Libraries(lets say Library A & Library B) and both have a class(lets name the class abc.class) with the same classname but the classes dont have the same Implementation! Now one of my testclasses uses abc.class from Library A, which is the wrong class/library. This testclass should use abc.class from Library B. I cant just delete the Library A because i needed also for other testclasses.
My SetUp:
- Maven: apache-maven-3.6.1
- Java: jdk11
- IDE: IntelliJ
My Question: Is there a way to pin diffrent Libraries for specific classes? So i could pin the Library B to my failing testclass, so it can use the right Library and the right implementation for the abc.class.
In the best case, i would like to fix it in the POM :)
Pls let me know if its somehow possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
否。
您需要具有班级的兼容版本。
甚至更好地只包括一种类型的班级。
No.
You need to have compatible versions of the class.
Or even better only include one type of Class to your build.