我有一个在SBT13.7中工作良好的build.sbt文件。但是在13.8中,它给了我一个“表达式中的类型错误”错误。它在这一行的开头抛出错误:
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{ ...如果我完全删除mergeStrategy块,它将在该行开头给出相同的“表达式中的类型错误”:
jarName in assembly := "theBigServer.jar"所以我假设它与“组装”有问题。这是否应该在13.8中有不同的处理方式?
这是完整的build.sbt文件:
organization := "com.myco"
version := "0.1"
scalaVersion := "2.11.6"
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")
resolvers ++= Seq(
"spray repo" at "http://repo.spray.io/",
"Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases" // for scalaz-stream
)
libraryDependencies ++= {
val akkaV = "2.3.9"
val sprayV = "1.3.2"
Seq(
"io.spray" %% "spray-can" % sprayV,
"io.spray" %% "spray-routing" % sprayV,
"io.spray" %% "spray-testkit" % sprayV,
"io.argonaut" %% "argonaut" % "6.0.4",
"com.typesafe.akka" %% "akka-actor" % akkaV,
"com.typesafe.akka" %% "akka-testkit" % akkaV,
"com.github.nscala-time" %% "nscala-time" % "1.8.0",
"commons-codec" % "commons-codec" % "1.10",
"com.amazonaws" % "aws-java-sdk" % "1.9.25"
)
}
seq(Revolver.settings: _*)
// put this in to eliminate deduplicate errors in sbt-assembly when making fat JAR
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList(ps @ _*) if ps.last endsWith "ArgumentsProcessor.class" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith "MatchersBinder.class" => MergeStrategy.first
case "application.conf" => MergeStrategy.concat
case "unwanted.txt" => MergeStrategy.discard
case x => old(x)
}
}
jarName in assembly := "theBigServer.jar"
mainClass in assembly := Some("servletRunner.Boot")发布于 2015-04-13 23:33:48
好的,修复了它-似乎问题来自我安装sbt的方式。我按照Scala-sbt.org的手册 安装说明 (实际上只是指定unix,而且我也假设它也适用于linux )将它安装到linux 17上。这导致了我在上面看到的问题。然后我卸载,并通过apt-get重新安装使用他们的Debian指令,现在sbt工作良好。我没有花更多的时间去修理我的手动安装。也许有办法让它发挥作用。我也不知道。
https://stackoverflow.com/questions/29571130
复制相似问题