Find duplicated classes in classpath

I have a Java application built with Maven with a lot of dependencies. When performing my test cases they sometimes pass fine, sometimes they fail because of some incompatible class combinations. So it seems to that there must be some classes twice in classpath which are taken randomly. The one is fine the other not.

  • How can I find out which classes / jars are incompatible in my classpath?
  • What is the right approach using Maven not to fall in that compatibility-traps?

Answer

I think a better solution would be to use the maven-duplicate-finder-plugin.

Note: The new version is the duplicate-finder-maven-plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *