You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by MichaƂ Siatkowski <at...@gmail.com> on 2018/05/22 08:17:14 UTC

How maven assembly plugin auto-resolves classpath conflicts (example case)

Hello.

I have found this to be an issue while migrating a project from Maven to
SBT.
SBT is only here for reference since it reports what I think should be
reported.

To describe the problem I have created an example project with dependencies
that I found to behave differently, depending on the build tool.
https://github.com/atais/mvn-sbt-assembly

The only dependencies are (sbt style)

"com.netflix.astyanax" % "astyanax-cassandra" % "3.9.0",
"org.apache.cassandra" % "cassandra-all" % "3.4",

and what I do not understand is, why mvn package creates the fat jar
successfully, while sbt assembly gives conflicts:

[error] 39 errors were encountered during merge
[error] java.lang.RuntimeException: deduplicate: different file contents
found in the following:
[error]
/home/siatkowskim/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.7.jar:org/apache/commons/logging/<some
classes>
[error]
/home/siatkowskim/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar:org/apache/commons/logging/<some
classes>
...
[error]
/home/siatkowskim/.ivy2/cache/com.github.stephenc.high-scale-lib/high-scale-lib/jars/high-scale-lib-1.1.2.jar:org/cliffc/high_scale_lib/<some
classes>
[error]
/home/siatkowskim/.ivy2/cache/com.boundary/high-scale-lib/jars/high-scale-lib-1.0.6.jar:org/cliffc/high_scale_lib/<some
classes>
...

How come Maven knows which class to take?
How can it be sure, that it is the correct choice?

There is a question on SO, if you would like to earn some points:
https://stackoverflow.com/questions/50249818/why-maven-assembly-works-when-sbt-assembly-find-conflicts

I have been directed here, from
https://issues.apache.org/jira/projects/MASSEMBLY/issues/MASSEMBLY-887