Like the title says, is there a way to deal with this? I have imported two separate third party libraries and they have a fully qualified class name conflict.
Right now both libraries are being imported in jar form, and it appears that in some environments (command line invocation, Eclipse) the correct class is found and in others (Maven) the wrong class is found and I get a missing method exception. If no solution can be found, I can fall back to re-factoring one of these libraries and rebuilding the jar, but I would rather not have to repeat that work every time the library has an update.
Edit: If anyone sees this later and is confused, I accepted Dave Newton's answer because it would be the correct way to do this if you were diligent enough to catch this problem before writing all of your code. Fixing the imports automagically after writing all the code appears to be impossible, as I suspected.
You either shade, bust them apart and remove the dupes, or...
When you have multiple implementations you are at the mercy of your classloader(s) unless you take active steps to mitigate the dupes.
Further discussion at this SO question.
来源:https://stackoverflow.com/questions/12823048/dealing-with-duplicate-fully-qualified-names