sbt汇编插件包括"提供"图书馆和它的血统

时间:2017-01-19 10:27:29

标签: scala sbt apache-flink

这是我的build.sbt

resolvers  ++= Seq("Apache Development Snapshot Repository" at "https://repository.apache.org/content/repositories/snapshots/",
  Resolver.mavenLocal)

name := "flink-wiki-edits"

version := "1.0"

scalaVersion := "2.11.7"

val flinkVersion = "1.1.3"

val flinkDependencies = Seq(
  "org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
  "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided",
  "org.apache.flink" %% "flink-connector-wikiedits"% flinkVersion )

lazy val root = (project in file(".")).
  settings(
    libraryDependencies ++= flinkDependencies
  )

mainClass in assembly := Some("com.ta.WikipediaAnalytics")

// make run command include the provided dependencies
run in Compile <<= Defaults.runTask(fullClasspath in Compile, mainClass in (Compile, run), runner in (Compile, run))

// exclude Scala library from assembly
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)

以及$ sbt assembly

的控制台输出代码段
vagrant@vagrant-ubuntu-trusty-64:/workspace/flink-wiki-edits$ sbt assembly
[info] Loading project definition from /workspace/flink-wiki-edits/project
[info] Set current project to flink-wiki-edits (in build file:/workspace/flink-wiki-edits/)
[info] Including: flink-connector-wikiedits_2.11-1.1.3.jar
[info] Including: flink-streaming-java_2.11-1.1.3.jar
[info] Including: flink-core-1.1.3.jar
[info] Including: flink-annotations-1.1.3.jar
[info] Including: jsr305-1.3.9.jar
[info] Including: commons-lang3-3.3.2.jar
[info] Including: slf4j-api-1.7.7.jar
[info] Including: slf4j-log4j12-1.7.7.jar
[info] Including: log4j-1.2.17.jar
[info] Including: force-shading-1.1.3.jar
[info] Including: flink-metrics-core-1.1.3.jar
[info] Including: kryo-2.24.0.jar
[info] Including: minlog-1.2.jar

我看到许多库是

的一部分
"org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
"org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided"

血统,我认为提供将在组装胖罐时排除库,让我知道我是否忽略了某些东西。

1 个答案:

答案 0 :(得分:1)

这是由 flink-connector-wikiedits 库引起依赖 flink-streaming-java_2.11 引起的,请参阅:flink-streaming-java_2.11 pom

   <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-java_2.11</artifactId>
      <version>1.1.3</version>
      <scope>compile</scope>
    </dependency>

并且 flink-streaming-java_2.11 具有 flink-core ... 依赖关系,请参阅:

http://search.maven.org/#artifactdetails%7Corg.apache.flink%7Cflink-streaming-java_2.11%7C1.1.3%7Cjar