kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [2/2] kudu git commit: java: revisit maven shade configuration
Date Tue, 28 Nov 2017 18:39:32 GMT
java: revisit maven shade configuration

This is a followup to [1], which reconfigured the Maven Shade Plugin to
apply excludes to all shaded jars, most notably on Guava classes. This
causes issues with kudu-flume-sink, which has a legitimate transitive
dependency on Guava through flume itself.

While investigating this issue I found that the `<include>*:*</include>`
configuration we commonly set for the shade plugin caused more
dependencies to be included than desired, for instance kudu-client-tools
was including hadoop-client, which was in provided scope.

The fix to both of these issues ended up being the same: only set the
exclusions where they should take effect in kudu-client, and be more
explicit about what jars should be included when shading in all other
modules.

I've done my best to make sure that the correct jars are still included
in the shaded jars using `jar -tf`.

[1]: https://github.com/apache/kudu/commit/5a258508f8d560f630512c237711a65cd137c6b3

Change-Id: I8f02a37a5a6683dbbb226a1faf96647a112d7c0d
Reviewed-on: http://gerrit.cloudera.org:8080/8661
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mpercy@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/68fa8010
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/68fa8010
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/68fa8010

Branch: refs/heads/master
Commit: 68fa8010dddad81dd702c6f05fda7d561d9beef9
Parents: 58b514d
Author: Dan Burkert <danburkert@apache.org>
Authored: Mon Nov 27 17:49:28 2017 -0800
Committer: Dan Burkert <danburkert@apache.org>
Committed: Tue Nov 28 18:35:14 2017 +0000

----------------------------------------------------------------------
 java/kudu-client-tools/pom.xml |  5 ++-
 java/kudu-client/pom.xml       | 22 ++++++++++++
 java/kudu-flume-sink/pom.xml   | 67 ++++++++++++++++++++-----------------
 java/kudu-spark-tools/pom.xml  |  5 ++-
 java/kudu-spark/pom.xml        |  4 ++-
 java/pom.xml                   | 22 ------------
 6 files changed, 69 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/68fa8010/java/kudu-client-tools/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-client-tools/pom.xml b/java/kudu-client-tools/pom.xml
index 95dda53..430ba98 100644
--- a/java/kudu-client-tools/pom.xml
+++ b/java/kudu-client-tools/pom.xml
@@ -110,7 +110,10 @@
                 <configuration>
                     <artifactSet>
                         <includes>
-                            <include>*:*</include>
+                            <include>org.apache.kudu:kudu-client</include>
+                            <include>org.apache.kudu:kudu-mapreduce</include>
+                            <include>org.apache.yetus:audience-annotations</include>
+                            <include>org.apache.parquet:parquet-hadoop</include>
                         </includes>
                     </artifactSet>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/kudu/blob/68fa8010/java/kudu-client/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-client/pom.xml b/java/kudu-client/pom.xml
index 2f510d6..4eb2740 100644
--- a/java/kudu-client/pom.xml
+++ b/java/kudu-client/pom.xml
@@ -170,6 +170,28 @@
                     <include>io.netty:netty</include>
                   </includes>
                 </artifactSet>
+                <relocations>
+                  <relocation>
+                    <pattern>com.google.common</pattern>
+                    <shadedPattern>org.apache.kudu.shaded.com.google.common</shadedPattern>
+                  </relocation>
+                  <relocation>
+                    <pattern>com.google.thirdparty</pattern>
+                    <shadedPattern>org.apache.kudu.shaded.com.google.thirdparty</shadedPattern>
+                  </relocation>
+                  <relocation>
+                    <pattern>com.google.protobuf</pattern>
+                    <shadedPattern>org.apache.kudu.shaded.com.google.protobuf</shadedPattern>
+                  </relocation>
+                  <relocation>
+                    <pattern>com.sangupta</pattern>
+                    <shadedPattern>org.apache.kudu.shaded.com.sangupta</shadedPattern>
+                  </relocation>
+                  <relocation>
+                    <pattern>org.jboss.netty</pattern>
+                    <shadedPattern>org.apache.kudu.shaded.org.jboss.netty</shadedPattern>
+                  </relocation>
+                </relocations>
               </configuration>
             </plugin>
             <!-- Attach source and javadoc to packaged jar -->

http://git-wip-us.apache.org/repos/asf/kudu/blob/68fa8010/java/kudu-flume-sink/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-flume-sink/pom.xml b/java/kudu-flume-sink/pom.xml
index fd7d407..d38974f 100644
--- a/java/kudu-flume-sink/pom.xml
+++ b/java/kudu-flume-sink/pom.xml
@@ -20,43 +20,17 @@
   <artifactId>kudu-flume-sink</artifactId>
   <name>Kudu Flume NG Sink</name>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${maven-shade-plugin.version}</version>
-        <configuration>
-          <artifactSet>
-            <includes>
-              <!-- We want to transitively shade what kudu-client shades. -->
-              <include>org.apache.kudu:kudu-client</include>
-            </includes>
-          </artifactSet>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.avro</groupId>
-        <artifactId>avro-maven-plugin</artifactId>
-        <version>${avro.version}</version>
-        <executions>
-          <execution>
-            <phase>generate-test-sources</phase>
-              <goals>
-                <goal>schema</goal>
-              </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
   <dependencies>
     <dependency>
       <groupId>org.apache.kudu</groupId>
       <artifactId>kudu-client</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.yetus</groupId>
+      <artifactId>audience-annotations</artifactId>
+      <version>${yetus.version}</version>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.flume</groupId>
@@ -104,4 +78,35 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>${maven-shade-plugin.version}</version>
+        <configuration>
+          <artifactSet>
+            <includes>
+              <include>org.apache.kudu:kudu-client</include>
+              <include>org.slf4:slf4j-api</include>
+              <include>com.stumbleupon:async</include>
+            </includes>
+          </artifactSet>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.avro</groupId>
+        <artifactId>avro-maven-plugin</artifactId>
+        <version>${avro.version}</version>
+        <executions>
+          <execution>
+            <phase>generate-test-sources</phase>
+              <goals>
+                <goal>schema</goal>
+              </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>

http://git-wip-us.apache.org/repos/asf/kudu/blob/68fa8010/java/kudu-spark-tools/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-spark-tools/pom.xml b/java/kudu-spark-tools/pom.xml
index 97a3b44..4dc811f 100644
--- a/java/kudu-spark-tools/pom.xml
+++ b/java/kudu-spark-tools/pom.xml
@@ -179,7 +179,10 @@
                 <configuration>
                     <artifactSet>
                         <includes>
-                            <include>*:*</include>
+                            <include>org.apache.kudu:kudu-client</include>
+                            <include>org.apache.kudu:kudu-${spark.version.label}_${scala.binary.version}</include>
+                            <include>org.apache.yetus:audience-annotations</include>
+                            <include>com.databricks:spark-avro_${scala.binary.version}</include>
                         </includes>
                     </artifactSet>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/kudu/blob/68fa8010/java/kudu-spark/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-spark/pom.xml b/java/kudu-spark/pom.xml
index c579b5a..f7c60e5 100644
--- a/java/kudu-spark/pom.xml
+++ b/java/kudu-spark/pom.xml
@@ -139,7 +139,9 @@
                 <configuration>
                     <artifactSet>
                         <includes>
-                            <include>*:*</include>
+                            <include>org.apache.kudu:kudu-client</include>
+                            <include>org.slf4:slf4j-api</include>
+                            <include>com.stumbleupon:async</include>
                         </includes>
                     </artifactSet>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/kudu/blob/68fa8010/java/pom.xml
----------------------------------------------------------------------
diff --git a/java/pom.xml b/java/pom.xml
index d3df466..bfb2998 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -166,28 +166,6 @@
                     <artifactId>maven-shade-plugin</artifactId>
                     <version>${maven-shade-plugin.version}</version>
                     <configuration>
-                        <relocations>
-                            <relocation>
-                                <pattern>com.google.common</pattern>
-                                <shadedPattern>org.apache.kudu.shaded.com.google.common</shadedPattern>
-                            </relocation>
-                            <relocation>
-                                <pattern>com.google.protobuf</pattern>
-                                <shadedPattern>org.apache.kudu.shaded.com.google.protobuf</shadedPattern>
-                            </relocation>
-                            <relocation>
-                                <pattern>com.google.thirdparty</pattern>
-                                <shadedPattern>org.apache.kudu.shaded.com.google.thirdparty</shadedPattern>
-                            </relocation>
-                            <relocation>
-                                <pattern>com.sangupta</pattern>
-                                <shadedPattern>org.apache.kudu.shaded.com.sangupta</shadedPattern>
-                            </relocation>
-                            <relocation>
-                                <pattern>org.jboss.netty</pattern>
-                                <shadedPattern>org.apache.kudu.shaded.org.jboss.netty</shadedPattern>
-                            </relocation>
-                        </relocations>
                         <shadeTestJar>true</shadeTestJar>
                     </configuration>
                     <executions>


Mime
View raw message