i have a maven project that has two dependencies: DependencyA and DependencyB. In each of the dependencies there is a class, lets call it FooClass.
Now there is a problem, because one class of my project needs the FooClass of DependencyA and another class needs the FooClass of DependencyB. But both classes load the FooClass of DependencyA.
Can i solve this problem with maven? Or do i have to think about the design of my project structure?
You should avoid getting two classes with same name in same package. This would lead to the idea that you have two modules of different versions of one code...
It would not be an issue if you had for instance com.yourcompany.yourproyectA.FooClass and com.yourcompany.yourproyectB.FooClass.
This scenario happens often and I have never had an issue with maven.
Regards
If two libraries need two different versions of the same library, I recommend to use a module system such as OSGi.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With