排除使用SBT创建胖罐的依赖性

时间:2017-02-28 13:04:43

标签: sbt akka sbt-assembly

我正在写一个akka应用程序。在创建远程应用程序时,我不希望scala库与jar一起打包。我的build.sbt如下所示:

lazy val root = (project in file(".")).
  settings(
    name :="akka-app",
    version :="1.0",
    scalaVersion :="2.10.4",
    mainClass in Compile := Some("sample.hello.HelloWorld")            
  )

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.3.4" % "provided",
  "com.typesafe" % "config" % "1.2.1"

)

// META-INF discarding
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
   {   
    case PathList("META-INF", xs @ _*) => MergeStrategy.discard
    case x => MergeStrategy.first
   }   
}

但是这个sbt用jar包scala。我只想在jar中出现com.typesafe.config库。任何解决方案如何实现这一目标?

1 个答案:

答案 0 :(得分:0)

您可以通过修改assemblyOption设置中的选项来排除Scala:

assemblyOption in assembly := 
  (assemblyOption in assembly).value.copy(includeScala = false)