sbt包未添加依赖项

时间:2019-07-10 08:00:09

标签: scala apache-spark sbt spark-cassandra-connector

我正在尝试使用sbt package来构建jar。

build.sbt

name := "Simple Project"
version := "0.1"

scalaVersion := "2.11.8"
val sparkVersion = "2.3.2"
val connectorVersion = "2.3.0"
val cassandraVersion = "3.11"

libraryDependencies ++= Seq(
  "org.apache.spark" %% "spark-core" % sparkVersion % "provided",
  "org.apache.spark" %% "spark-sql" % sparkVersion % "provided",
  "org.apache.spark" %% "spark-hive" % sparkVersion % "provided",
  "org.scalaj" %% "scalaj-http" % "2.4.2",
  "com.datastax.spark" %% "spark-cassandra-connector" % connectorVersion
)

sbt package运行成功,但未将spark-cassandra-connector和scalaj-http添加到创建的最终jar中。

我需要添加任何东西吗?

1 个答案:

答案 0 :(得分:4)

如果要让jar包含所有依赖项,则必须使用sbt assemlbly插件:

https://github.com/sbt/sbt-assembly