diff --git a/core/pom.xml b/core/pom.xml index be08943f5dda2..83c708dfc9619 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -345,6 +345,7 @@ + com.google.guava:guava diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index 542ec0166e791..e21b679a3cb84 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -289,6 +289,12 @@ object Assembly { } +/** + * Settings for the spark-core artifact. We don't want to expose Guava as a compile-time dependency, + * but at the same time the Java API exposes a Guava type (Optional). So we package it with the + * spark-core jar using the assembly plugin, and use the assembly deliverable as the main artifact + * for that project, disabling the non-assembly jar. + */ object CoreAssembly { import sbtassembly.Plugin._ import AssemblyKeys._ @@ -304,8 +310,8 @@ object CoreAssembly { cp filter {!_.data.getName.startsWith("guava")} }, mergeStrategy in assembly := { - case PathList("com", "google", "common", xs @ _*) => - if (xs.size == 2 && xs(0) == "base" && xs(1).startsWith("Optional")) { + case PathList("com", "google", "common", "base", xs @ _*) => + if (xs.size == 1 && xs(0).startsWith("Optional")) { MergeStrategy.first } else { MergeStrategy.discard