aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assembly/pom.xml18
-rw-r--r--core/pom.xml35
-rw-r--r--examples/pom.xml26
-rw-r--r--pom.xml16
-rw-r--r--project/SparkBuild.scala4
-rw-r--r--project/plugins.sbt4
6 files changed, 100 insertions, 3 deletions
diff --git a/assembly/pom.xml b/assembly/pom.xml
index 9fbb037115..de7b75258e 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -43,6 +43,12 @@
</properties>
<dependencies>
+ <!-- Promote Guava to compile scope in this module so it's included while shading. -->
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.binary.version}</artifactId>
@@ -113,6 +119,18 @@
<goal>shade</goal>
</goals>
<configuration>
+ <relocations>
+ <relocation>
+ <pattern>com.google</pattern>
+ <shadedPattern>org.spark-project.guava</shadedPattern>
+ <includes>
+ <include>com.google.common.**</include>
+ </includes>
+ <excludes>
+ <exclude>com.google.common.base.Optional**</exclude>
+ </excludes>
+ </relocation>
+ </relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
diff --git a/core/pom.xml b/core/pom.xml
index 6d8be37037..83c708dfc9 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -68,9 +68,15 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
+ <!--
+ Promote Guava to "compile" so that maven-shade-plugin picks it up (for packaging the Optional
+ class exposed in the Java API). The plugin will then remove this dependency from the published
+ pom, so that Guava does not pollute the client's compilation classpath.
+ -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -322,6 +328,35 @@
</arguments>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <shadedArtifactAttached>false</shadedArtifactAttached>
+ <artifactSet>
+ <includes>
+ <include>com.google.guava:guava</include>
+ </includes>
+ </artifactSet>
+ <filters>
+ <!-- See comment in the guava dependency declaration above. -->
+ <filter>
+ <artifact>com.google.guava:guava</artifact>
+ <includes>
+ <include>com/google/common/base/Optional*</include>
+ </includes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<resources>
diff --git a/examples/pom.xml b/examples/pom.xml
index 8c4c128bb4..9b12cb0c29 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -46,8 +46,14 @@
</dependencies>
</profile>
</profiles>
-
+
<dependencies>
+ <!-- Promote Guava to compile scope in this module so it's included while shading. -->
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.binary.version}</artifactId>
@@ -210,6 +216,12 @@
</artifactSet>
<filters>
<filter>
+ <artifact>com.google.guava:guava</artifact>
+ <excludes>
+ <exclude>com/google/common/base/Optional*</exclude>
+ </excludes>
+ </filter>
+ <filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
@@ -226,6 +238,18 @@
<goal>shade</goal>
</goals>
<configuration>
+ <relocations>
+ <relocation>
+ <pattern>com.google</pattern>
+ <shadedPattern>org.spark-project.guava</shadedPattern>
+ <includes>
+ <include>com.google.common.**</include>
+ </includes>
+ <excludes>
+ <exclude>com.google.common.base.Optional**</exclude>
+ </excludes>
+ </relocation>
+ </relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
diff --git a/pom.xml b/pom.xml
index 7ed07ad7df..9cbf3ea599 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,6 +260,7 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>14.0.1</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -1017,6 +1018,21 @@
<profiles>
+ <!--
+ This profile is enabled automatically by the sbt built. It changes the scope for the guava
+ dependency, since we don't shade it in the artifacts generated by the sbt build.
+ -->
+ <profile>
+ <id>sbt</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<!-- Ganglia integration is not included by default due to LGPL-licensed code -->
<profile>
<id>spark-ganglia-lgpl</id>
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index 49d52aefca..4c696d3d38 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -61,7 +61,7 @@ object SparkBuild extends PomBuild {
def backwardCompatibility = {
import scala.collection.mutable
var isAlphaYarn = false
- var profiles: mutable.Seq[String] = mutable.Seq.empty
+ var profiles: mutable.Seq[String] = mutable.Seq("sbt")
if (Properties.envOrNone("SPARK_GANGLIA_LGPL").isDefined) {
println("NOTE: SPARK_GANGLIA_LGPL is deprecated, please use -Pspark-ganglia-lgpl flag.")
profiles ++= Seq("spark-ganglia-lgpl")
@@ -116,7 +116,7 @@ object SparkBuild extends PomBuild {
retrieveManaged := true,
retrievePattern := "[type]s/[artifact](-[revision])(-[classifier]).[ext]",
publishMavenStyle := true,
-
+
resolvers += Resolver.mavenLocal,
otherResolvers <<= SbtPomKeys.mvnLocalRepository(dotM2 => Seq(Resolver.file("dotM2", dotM2))),
publishLocalConfiguration in MavenCompile <<= (packagedArtifacts, deliverLocal, ivyLoggingLevel) map {
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 2a61f56c2e..8096c61414 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -26,3 +26,7 @@ addSbtPlugin("com.alpinenow" % "junit_xml_listener" % "0.5.1")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.1")
addSbtPlugin("com.cavorite" % "sbt-avro" % "0.3.2")
+
+libraryDependencies += "org.ow2.asm" % "asm" % "5.0.3"
+
+libraryDependencies += "org.ow2.asm" % "asm-commons" % "5.0.3"