SBT构建文件无法识别“汇编”

时间:2015-04-10 21:41:47

标签: sbt

我有一个build.sbt文件在sbt 13.7中工作正常。但在13.8中,它给了我一个"类型错误的表达"错误。它会在此行的开头抛出错误:

mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{ ...

如果我完全删除mergeStrategy块,它会在表达式中给出相同的&#34;类型错误&#34;在这一行的开头改为:

jarName in assembly := "theBigServer.jar"

所以我假设它与#34; assembly&#34;有问题。这应该在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")

1 个答案:

答案 0 :(得分:0)

好的,修好了 - 似乎问题来自于我安装sbt的方式。我按照scala-sbt.org的手册 installation instructions将其安装到linux mint 17上(实际上只是指定了unix,我假设持有对于Linux也是如此。)这导致了我上面看到的问题。然后我卸载了,并使用他们的Debian instructions通过apt-get重新安装,现在sbt工作正常。我没有花时间去修理我的手动安装。也许有一种方法可以让它发挥作用。不知道。