Created
June 12, 2014 04:18
-
-
Save stantonk/5303b7ec84b782a58628 to your computer and use it in GitHub Desktop.
Black magic to tell sbt to choose the first duplicate class when resolving dependency collisions instead of just failing out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Black magic to tell sbt to choose the first duplicate class when resolving dependency collisions instead of just | |
* failing out. | |
*/ | |
mergeStrategy in assembly <<= (mergeStrategy in assembly) { | |
(old) => { | |
case x if Assembly.isConfigFile(x) => | |
MergeStrategy.concat | |
case PathList(ps@_*) if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) => | |
MergeStrategy.rename | |
case PathList("META-INF", xs@_*) => | |
(xs map { _.toLowerCase}) match { | |
case ("manifest.mf" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) => | |
MergeStrategy.discard | |
case ps@(x :: xs) if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") => | |
MergeStrategy.discard | |
case "plexus" :: xs => | |
MergeStrategy.discard | |
case "services" :: xs => | |
MergeStrategy.filterDistinctLines | |
case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) => | |
MergeStrategy.filterDistinctLines | |
case _ => MergeStrategy.deduplicate | |
} | |
case _ => MergeStrategy.first // overrides the default fallback MergeStrategy of deduplicate | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment