Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find duplicated classes in classpath

Tags:

java

maven

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?
like image 317
mibutec Avatar asked Sep 21 '12 18:09

mibutec


People also ask

How do you fix a duplicate class error in Java?

In such a case, the module is copied in the javasource folder in the app directory with a new name and the old folder is kept, resulting in two identical folders with different names. Simply delete the copied folder with the modulename that is not used and you should be fine.


1 Answers

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

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

like image 133
khmarbaise Avatar answered Oct 23 '22 18:10

khmarbaise