scala.MatchError: org\apache\commons\io\IOCase.class (of class java.lang.String) in sbt+assembly -
when user sbt assembly, prints error this:
[error] (*:assembly) scala.matcherror: org\apache\commons\io\iocase.class (of class java.lang.string)
and these configurations:
1、assembly.sbt:
import assemblykeys._ assemblysettings mergestrategy in assembly := { case pathlist("org", "springframework", xs@_*) => mergestrategy.last }
2、bulid.sbt
import assemblykeys._ lazy val root = (project in file(".")). settings( name := "dmprealtimeflow", version := "1.0", scalaversion := "2.11.8", librarydependencies += "com.jd.ads.index" % "ad_index_dmp_common" % "0.0.4-snapshot", librarydependencies += "org.apache.spark" % "spark-core_2.11" % "2.1.0" % "provided", librarydependencies += "org.apache.spark" % "spark-sql_2.11" % "2.1.0" % "provided", librarydependencies += "org.apache.spark" % "spark-streaming_2.11" % "2.1.0" % "provided", librarydependencies += "mysql" % "mysql-connector-java" % "5.1.8", librarydependencies += "org.springframework" % "spring-beans" % "3.1.0.release", librarydependencies += "org.springframework" % "spring-context" % "3.1.0.release", librarydependencies += "org.springframework" % "spring-core" % "3.1.0.release", librarydependencies += "org.springframework" % "spring-orm" % "3.1.0.release", librarydependencies += "org.mybatis" % "mybatis" % "3.2.1" % "compile", librarydependencies += "org.mybatis" % "mybatis-spring" % "1.2.2", librarydependencies += "c3p0" % "c3p0" % "0.9.1.2" )
3、project tools:
sbt:0.13.5 assembly:0.11.2 java:1.7 scala:2.11.8
any help?
the problem may in missing default case in mergestrategy in assembly block :
case x => val oldstrategy = (assemblymergestrategy in assembly).value oldstrategy(x)
also, mergestrategy deprecated , assemblymergestrategy should used instead.
basically
{ case pathlist("org", "springframework", xs@_*) => mergestrategy.last }
is partial function string => mergestrategy defined 1 type of inputs, i.e. classes package prefix "org\springframework". however, applied class files in project , first 1 doesn't match prefix above (org\apache\commons\io\iocase.class) causes matcherror.
Comments
Post a Comment