merge - sbt: how to write a MergeStrategy to choose a specific library version -


here attempt exclude javax.servlet classes:

librarydependencies ++= seq(  ..   ("org.apache.spark" % "spark-core_2.10" % sparkversion  \   % "compile->default"  withsources()).exclude("org.mortbay.jetty", "servlet-api"), 

here attempt @ mergestrategy:

mergestrategy in assembly <<= (mergestrategy in assembly) { (old) => {  ..     case pathlist("javax", "servlet", xs @ _*)         => mergestrategy.singleorerror    .. 

following shows multiple copies of javax.servlet classes being loaded:

[error] (*:assembly) singleorerror: found multiple files same target path: [error] c:\users\s80035683.ivy2\cache\org.mortbay.jetty\servlet-api-2.5\jars\servlet-api-2.5-6.1.14.jar:javax/servlet/filter.class [error] c:\users\s80035683.ivy2\cache\javax.servlet\servlet-api\jars\servlet-api-2.5.jar:javax/servlet/filter.class [error] c:\users\s80035683.ivy2\cache\org.eclipse.jetty.orbit\javax.servlet\orbits\javax.servlet-3.0.0.v201112011016.jar:javax/servlet/filter.class [error] c:\users\s80035683.ivy2\cache\org.mortbay.jetty\servlet-api\jars\servlet-api-2.5-20110124.jar:javax/servlet/filter.class

note: not duplicate since similar questions not address issue. example +the answer following question ("highest version selected default") not working

how sbt choose highest version amongst dependencies?

you can use sbt-dependency-graph , see servlet-api included transitive dependency.

you can using what-depends-on <organization> <module> <revision> command.

knowing can exclude transitive dependency.

this easier excluding class specific jar (unless don't care jar, , want take jar).

you can check answer another question on how write custom mergestrategy, know jar class comming.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -