diff options
author | Marcelo Vanzin <vanzin@cloudera.com> | 2014-08-20 16:23:10 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-08-20 16:23:10 -0700 |
commit | c9f743957fa963bc1dbed7a44a346ffce1a45cf2 (patch) | |
tree | 11700155aa14aa3c913a104fa36e6f78b599c741 /examples/pom.xml | |
parent | d9e94146a6e65be110a62e3bd0351148912a41d1 (diff) | |
download | spark-c9f743957fa963bc1dbed7a44a346ffce1a45cf2.tar.gz spark-c9f743957fa963bc1dbed7a44a346ffce1a45cf2.tar.bz2 spark-c9f743957fa963bc1dbed7a44a346ffce1a45cf2.zip |
[SPARK-2848] Shade Guava in uber-jars.
For further discussion, please check the JIRA entry.
This change moves Guava classes to a different package so that they don't conflict with the user-provided Guava (or the Hadoop-provided one). Since one class (Optional) was exposed through Spark's public API, that class was forked from Guava at the current dependency version (14.0.1) so that it can be kept going forward (until the API is cleaned).
Note this change has a few implications:
- *all* classes in the final jars will reference the relocated classes. If Hadoop classes are included (i.e. "-Phadoop-provided" is not activated), those will also reference the Guava 14 classes (instead of the Guava 11 classes from the Hadoop classpath).
- if the Guava version in Spark is ever changed, the new Guava will still reference the forked Optional class; this may or may not be a problem, but in the long term it's better to think about removing Optional from the public API.
For the end user, there are two visible implications:
- Guava is not provided as a transitive dependency anymore (since it's "provided" in Spark)
- At runtime, unless they provide their own, they'll either have no Guava or Hadoop's version of Guava (11), depending on how they set up their classpath.
Note that this patch does not change the sbt deliverables; those will still contain guava in its original package, and provide guava as a compile-time dependency. This assumes that maven is the canonical build, and sbt-built artifacts are not (officially) published.
Author: Marcelo Vanzin <vanzin@cloudera.com>
Closes #1813 from vanzin/SPARK-2848 and squashes the following commits:
9bdffb0 [Marcelo Vanzin] Undo sbt build changes.
819b445 [Marcelo Vanzin] Review feedback.
05e0a3d [Marcelo Vanzin] Merge branch 'master' into SPARK-2848
fef4370 [Marcelo Vanzin] Unfork Optional.java.
d3ea8e1 [Marcelo Vanzin] Exclude asm classes from final jar.
637189b [Marcelo Vanzin] Add hacky filter to prefer Spark's copy of Optional.
2fec990 [Marcelo Vanzin] Shade Guava in the sbt build.
616998e [Marcelo Vanzin] Shade Guava in the maven build, fork Guava's Optional.java.
Diffstat (limited to 'examples/pom.xml')
-rw-r--r-- | examples/pom.xml | 26 |
1 files changed, 25 insertions, 1 deletions
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"> |