我无法使用所有依赖库生成胖jar但没有scala库。我有build.sbt文件的下一个配置:
import AssemblyKeys._
assemblySettings
jarName in assembly := "test-project.jar"
assemblyOption in assembly ~= { _.copy(includeScala = false) }
name := "test-project"
version := "1.0"
scalaVersion := "2.10.4"
resolvers += Resolver.sonatypeRepo("public")
resolvers += "SnowPlow Repo" at "http://maven.snplow.com/releases/"
resolvers += "Twitter Maven Repo" at "http://maven.twttr.com/"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "1.2.1" % "provided",
"org.apache.avro" % "avro" % "1.7.7" % "provided" withSources(),
"org.apache.avro" % "avro-mapred" % "1.7.7" % "provided" withSources(),
"com.github.nscala-time" %% "nscala-time" % "1.8.0" withSources(),
"com.snowplowanalytics" %% "scala-maxmind-iplookups" % "0.2.0" withSources(),
"com.twitter" %% "algebird-core" % "0.9.0" withSources()
)
执行sbt程序集后,我收到包含项目代码和几乎所有库的test-project.jar
。唯一缺少的是"com.snowplowanalytics" %% "scala-maxmind-iplookups" % "0.2.0
依赖 - 这很奇怪。当我在build.sbt配置中删除行assemblyOption in assembly ~= { _.copy(includeScala = false) }
时,我正在接收完整的jar(包含所有库)以及我不需要的scala库类。
如何制作sbt
和sbt-assembly
插件来生成没有scala库的胖jar,但是使用所有其他依赖库但是。
sbt version: 0.13.5
sbt-assembly version: 0.11.2