This is an automated email from the ASF dual-hosted git repository.

yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 74e9881f27 [#10457] improvement: Shrink the package size of Hive 
Metastore 2 and 3 catalogs (#10465)
74e9881f27 is described below

commit 74e9881f27e1763d17d5af2b93aff7a1a7f26830
Author: Yuhui <[email protected]>
AuthorDate: Wed Mar 25 18:48:07 2026 +0800

    [#10457] improvement: Shrink the package size of Hive Metastore 2 and 3 
catalogs (#10465)
    
    ### What changes were proposed in this pull request?
    
    Reduce the distribution package size of Hive Metastore 2 and 3 catalog
    libs
    by adding dependency exclusions to filter out unnecessary transitive
    JARs.
    
    | Package | Before | After |
    |---------|--------|-------|
    | hive-metastore2-libs | 102MB (176 JARs) | 78MB (138 JARs) |
    | hive-metastore3-libs | 127MB (205 JARs) | 104MB (201 JARs) |
    
    Excluded categories: logging stack (slf4j/log4j/logback), test artifacts
    (junit/hamcrest), HBase, DataNucleus, Ant, Avro, Parquet, YARN server
    components, and compile-time annotation JARs.
    
    ### Why are the changes needed?
    
    Fixes #10457.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Unit tests and integration tests pass.
---
 catalogs/hive-metastore-common/build.gradle.kts |  9 ++---
 catalogs/hive-metastore2-libs/build.gradle.kts  | 51 ++++++++++++++++++++++++-
 catalogs/hive-metastore3-libs/build.gradle.kts  | 42 +++++++++++++++++++-
 3 files changed, 93 insertions(+), 9 deletions(-)

diff --git a/catalogs/hive-metastore-common/build.gradle.kts 
b/catalogs/hive-metastore-common/build.gradle.kts
index 70fca295eb..aee7e7b812 100644
--- a/catalogs/hive-metastore-common/build.gradle.kts
+++ b/catalogs/hive-metastore-common/build.gradle.kts
@@ -31,15 +31,13 @@ dependencies {
   compileOnly(libs.hive2.metastore)
   compileOnly(libs.immutables.value)
   compileOnly(libs.lombok)
+  compileOnly(libs.caffeine)
+  compileOnly(libs.guava)
+  compileOnly(libs.slf4j.api)
 
   implementation(project(":catalogs:catalog-common")) {
     exclude("*")
   }
-  implementation(project(":clients:client-java-runtime", configuration = 
"shadow"))
-
-  implementation(libs.caffeine)
-  implementation(libs.guava)
-  implementation(libs.slf4j.api)
 
   annotationProcessor(libs.immutables.value)
   annotationProcessor(libs.lombok)
@@ -118,6 +116,7 @@ dependencies {
     exclude("org.slf4j")
   }
   testImplementation(libs.htrace.core4)
+  testImplementation(libs.caffeine)
   testImplementation(libs.junit.jupiter.api)
   testImplementation(libs.mockito.core)
   testImplementation(libs.testcontainers)
diff --git a/catalogs/hive-metastore2-libs/build.gradle.kts 
b/catalogs/hive-metastore2-libs/build.gradle.kts
index b539a1c45b..3f55832464 100644
--- a/catalogs/hive-metastore2-libs/build.gradle.kts
+++ b/catalogs/hive-metastore2-libs/build.gradle.kts
@@ -25,9 +25,56 @@ plugins {
   id("idea")
 }
 
+// Note: exclusion lists here are intentionally kept in sync with 
hive-metastore3-libs/build.gradle.kts.
+// Guava and Logback are excluded because they are provided by the Gravitino 
runtime classpath.
 dependencies {
-  implementation(libs.hadoop2.common)
-  implementation(libs.hive2.metastore)
+  implementation(libs.hadoop2.common) {
+    exclude(group = "ch.qos.logback")
+    exclude(group = "com.github.spotbugs")
+    exclude(group = "com.google.code.findbugs")
+    exclude(group = "com.google.guava")
+    exclude(group = "log4j")
+    exclude(group = "org.apache.avro")
+    exclude(group = "org.apache.logging.log4j")
+    exclude(group = "org.eclipse.jetty.aggregate", module = "jetty-all")
+    exclude(group = "org.eclipse.jetty.orbit", module = "javax.servlet")
+    exclude(group = "org.slf4j")
+  }
+  implementation(libs.hadoop2.mapreduce.client.core) {
+    exclude(group = "com.github.spotbugs")
+    exclude(group = "com.google.code.findbugs")
+    exclude(group = "com.google.guava")
+    exclude(group = "log4j")
+    exclude(group = "org.apache.avro")
+    exclude(group = "org.apache.logging.log4j")
+    exclude(group = "org.slf4j")
+  }
+  implementation(libs.hive2.metastore) {
+    exclude(group = "ant")
+    exclude(group = "ch.qos.logback")
+    exclude(group = "co.cask.tephra")
+    exclude(group = "com.github.joshelser")
+    exclude(group = "com.github.spotbugs")
+    exclude(group = "com.google.code.findbugs")
+    exclude(group = "com.google.guava")
+    exclude(group = "log4j")
+    exclude(group = "com.tdunning", module = "json")
+    exclude(group = "com.zaxxer", module = "HikariCP")
+    exclude(group = "io.dropwizard.metrics")
+    exclude(group = "javax.transaction", module = "transaction-api")
+    exclude(group = "junit")
+    exclude(group = "org.apache.ant")
+    exclude(group = "org.apache.avro")
+    exclude(group = "org.apache.hadoop", module = 
"hadoop-yarn-server-resourcemanager")
+    exclude(group = "org.apache.hbase")
+    exclude(group = "org.apache.logging.log4j")
+    exclude(group = "org.apache.parquet", module = "parquet-hadoop-bundle")
+    exclude(group = "org.datanucleus")
+    exclude(group = "org.eclipse.jetty.aggregate", module = "jetty-all")
+    exclude(group = "org.eclipse.jetty.orbit", module = "javax.servlet")
+    exclude(group = "org.openjdk.jol")
+    exclude(group = "org.slf4j")
+  }
 }
 
 tasks {
diff --git a/catalogs/hive-metastore3-libs/build.gradle.kts 
b/catalogs/hive-metastore3-libs/build.gradle.kts
index ca0ea1ea24..fa2a1a56a4 100644
--- a/catalogs/hive-metastore3-libs/build.gradle.kts
+++ b/catalogs/hive-metastore3-libs/build.gradle.kts
@@ -25,9 +25,47 @@ plugins {
   id("idea")
 }
 
+// Note: exclusion lists here are intentionally kept in sync with 
hive-metastore2-libs/build.gradle.kts.
+// Guava and Logback are excluded because they are provided by the Gravitino 
runtime classpath.
 dependencies {
-  implementation(libs.hadoop2.common)
-  implementation(libs.hive3.metastore)
+  implementation(libs.hadoop2.common) {
+    exclude(group = "ch.qos.logback")
+    exclude(group = "com.github.spotbugs")
+    exclude(group = "com.google.code.findbugs")
+    exclude(group = "com.google.guava")
+    exclude(group = "log4j")
+    exclude(group = "org.apache.avro")
+    exclude(group = "org.apache.logging.log4j")
+    exclude(group = "org.eclipse.jetty.aggregate", module = "jetty-all")
+    exclude(group = "org.eclipse.jetty.orbit", module = "javax.servlet")
+    exclude(group = "org.slf4j")
+  }
+  implementation(libs.hive3.metastore) {
+    exclude(group = "ant")
+    exclude(group = "ch.qos.logback")
+    exclude(group = "co.cask.tephra")
+    exclude(group = "com.github.joshelser")
+    exclude(group = "com.github.spotbugs")
+    exclude(group = "com.google.code.findbugs")
+    exclude(group = "com.google.guava")
+    exclude(group = "log4j")
+    exclude(group = "com.tdunning", module = "json")
+    exclude(group = "com.zaxxer", module = "HikariCP")
+    exclude(group = "io.dropwizard.metrics")
+    exclude(group = "javax.transaction", module = "transaction-api")
+    exclude(group = "junit")
+    exclude(group = "org.apache.ant")
+    exclude(group = "org.apache.avro")
+    exclude(group = "org.apache.hadoop", module = 
"hadoop-yarn-server-resourcemanager")
+    exclude(group = "org.apache.hbase")
+    exclude(group = "org.apache.logging.log4j")
+    exclude(group = "org.apache.parquet", module = "parquet-hadoop-bundle")
+    exclude(group = "org.datanucleus")
+    exclude(group = "org.eclipse.jetty.aggregate", module = "jetty-all")
+    exclude(group = "org.eclipse.jetty.orbit", module = "javax.servlet")
+    exclude(group = "org.openjdk.jol")
+    exclude(group = "org.slf4j")
+  }
 }
 
 tasks {

Reply via email to