Sbt 程序集不包括所有库依赖项
Sbt assembly is not including all library dependencies
我无法生成包含所有依赖库但没有 scala 库的 fat jar。我有 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 assembly 后,我收到 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 库但有所有其他依赖库的 fat jar。
sbt version: 0.13.5
sbt-assembly version: 0.11.2
看看https://github.com/sbt/sbt-assembly/issues/116
可能是旧版插件的bug
我无法生成包含所有依赖库但没有 scala 库的 fat jar。我有 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 assembly 后,我收到 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 库但有所有其他依赖库的 fat jar。
sbt version: 0.13.5
sbt-assembly version: 0.11.2
看看https://github.com/sbt/sbt-assembly/issues/116 可能是旧版插件的bug