Duplicate classes

In one of my plugins I’m using my library TraJ. This library use the parallelcolt and the renjin library but not the jtransforms library. I’ve now got the following exception when I try to apply my plugin.

There was a problem with the class edu.emory.mathcs.utils.ConcurrencyUtils which can be found here:
/home/thorsten/Dokumente/ImageJ/Fiji.app/jars/jtransforms-2.4.jar
/home/thorsten/Dokumente/ImageJ/Fiji.app/jars/parallelcolt-0.9.4.jar
/home/thorsten/Dokumente/ImageJ/Fiji.app/jars/renjin-script-engine-0.8.2050-jar-with-dependencies.jar

I would be happy for any suggestion how to resolve that issue.

Hello Thorsten,

if you look into the renjin jar (renjin-studio-0.8.2110-jar-with-dependencies.jar), e.g., with 7-zip you see that it bundles the jtransforms classes (see below):

1 Like

Thanks!
Yes, I already assumed that but how can I solve this issue using maven?
I don’t want to rebuild the parallelcolt and renjin-engine library…

I think @ctrueden would be the best person to answer that question.

You can inspect your dependencies from the CLI using:

mvn dependency:tree

Or look at them in Eclipse by double-clicking the POM and clicking the Dependency Hierarchy tab. (I find the Eclipse view is more informative and complete, although I use the CLI view more often because it is convenient.)

One of the dependencies of TraJ is transitively bringing in the dependency on renjin-studio-0.8.2110-jar-with-dependencies. This is bad. Your ultimate goal should be to eliminate the renjin-studio-0.8.2110-jar-with-dependencies dependency because it is an uber-JAR which will clash with each standalone library being bundled.

However, if you cannot eliminate that dependency directly, you can use exclusions in your POM to avoid the clash. Here are some examples from pom-scijava.

1 Like

OK, I resolved the dependency issue to renjin. Thanks @ctrueden

However the problem between
/home/thorsten/Dokumente/ImageJ/Fiji.app/jars/jtransforms-2.4.jar
/home/thorsten/Dokumente/ImageJ/Fiji.app/jars/parallelcolt-0.9.4.jar
still exists…

The issue seems to be known and not easily resolvable:

Any ideas?

@twagner I don’t have time to dig into it, but if indeed both of those libraries are published with overlapping class files, which apparently (from the linked post) have different code in them, then the idea of renaming one of the classes and using that instead in e.g. JTransforms is the way to go. You could roll your own version of JTransforms that does that, but it would require cloning the code, renaming the class, and publishing your forked version. Not especially fun stuff.

I think you did the right thing to post on the parallelcolt forum. You might also post the same question on the JTransforms GitHub Issues.

@ctrueden
I’ve fixed it. Lets see the reactions…

2 Likes

Merged already! Great!