World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
description = "catalog-hive"
plugins {
`maven-publish`
id("java")
id("idea")
}
val scalaVersion: String = project.properties["scalaVersion"] as? String ?: extra["defaultScalaVersion"].toString()
val sparkVersion: String = libs.versions.spark34.get()
val icebergVersion: String = libs.versions.iceberg.get()
val scalaCollectionCompatVersion: String = libs.versions.scala.collection.compat.get()
dependencies {
compileOnly(project(":api"))
compileOnly(project(":common"))
compileOnly(project(":core"))
compileOnly(libs.immutables.value)
compileOnly(libs.lombok)
implementation(project(":catalogs:catalog-common")) {
exclude("*")
}
implementation(project(":catalogs:hive-metastore-common"))
implementation(libs.commons.collections3)
implementation(libs.commons.configuration1) {
exclude(group = "commons-beanutils")
}
implementation(libs.commons.io)
implementation(libs.commons.lang3)
implementation(libs.guava)
implementation(libs.jackson.databind)
implementation(libs.hadoop3.auth) {
exclude("*")
}
implementation(libs.hadoop3.common) {
exclude("*")
}
// Hadoop 3.x runtime requirements (stripped by exclude("*") above)
implementation(libs.hadoop3.shaded.guava)
implementation(libs.hadoop3.shaded.protobuf)
implementation(libs.commons.configuration2)
implementation(libs.re2j)
implementation(libs.slf4j.api)
implementation(libs.woodstox.core)
annotationProcessor(libs.immutables.value)
annotationProcessor(libs.lombok)
testImplementation(project(":api"))
testImplementation(project(":catalogs:hadoop-common")) {
exclude("*")
}
testImplementation(project(":catalogs:hive-metastore-common", "testArtifacts"))
testImplementation(project(":clients:client-java"))
testImplementation(project(":common"))
testImplementation(project(":core"))
testImplementation(project(":integration-test-common", "testArtifacts"))
testImplementation(project(":server"))
testImplementation(project(":server-common"))
testImplementation("org.apache.spark:spark-hive_$scalaVersion:$sparkVersion") {
exclude("org.apache.hadoop")
}
testImplementation("org.apache.spark:spark-sql_$scalaVersion:$sparkVersion") {
exclude("org.apache.avro")
exclude("org.apache.hadoop")
exclude("org.apache.zookeeper")
exclude("io.dropwizard.metrics")
exclude("org.rocksdb")
}
testImplementation("org.scala-lang.modules:scala-collection-compat_$scalaVersion:$scalaCollectionCompatVersion")
testImplementation(libs.awaitility)
testImplementation(libs.bundles.jersey)
testImplementation(libs.bundles.jetty)
testImplementation(libs.bundles.log4j)
testImplementation(libs.hadoop3.aws) {
exclude("software.amazon.awssdk", "bundle")
}
testImplementation(libs.bundles.hadoop.aws.sdk)
testImplementation(libs.hadoop3.common) {
exclude("*")
}
testImplementation(libs.hadoop3.hdfs)
testImplementation(libs.hadoop3.hdfs.client)
testImplementation(libs.hadoop3.mapreduce.client.core) {
exclude("*")
}
// Hadoop 3.x runtime requirements (stripped by exclude("*") above)
testImplementation(libs.hadoop3.shaded.guava)
testImplementation(libs.hadoop3.shaded.protobuf)
testImplementation(libs.commons.configuration2)
testImplementation(libs.re2j)
testImplementation(libs.hadoop3.abs)
testImplementation(libs.hadoop3.gcs)
testImplementation(libs.hive2.common) {
exclude("org.eclipse.jetty.aggregate", "jetty-all")
exclude("org.eclipse.jetty.orbit", "javax.servlet")
}
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.mockito.core)
testImplementation(libs.mysql.driver)
testImplementation(libs.postgresql.driver)
testImplementation(libs.slf4j.api)
testImplementation(libs.testcontainers)
testImplementation(libs.testcontainers.localstack)
testImplementation(libs.testcontainers.mysql)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks {
// HiveClientClassLoader loads the version-specific client and shim jars from these modules at
// runtime. Build them together with the Hive catalog so every downstream integration test that
// depends on this jar has a complete Hive client runtime.
jar {
dependsOn(
":catalogs:hive-metastore2-libs:jar",
":catalogs:hive-metastore3-libs:jar"
)
}
register("runtimeJars", Copy::class) {
from(configurations.runtimeClasspath)
into("build/libs")
}
val copyCatalogLibs by registering(Copy::class) {
dependsOn("jar", "runtimeJars")
from("build/libs") {
exclude("guava-*.jar")
exclude("log4j-*.jar")
exclude("slf4j-*.jar")
exclude("error_prone_annotations-*.jar")
// Exclude the following jars to avoid conflict with the jars in authorization-gcp
exclude("protobuf-java-*.jar")
}
into("$rootDir/distribution/package/catalogs/hive/libs")
}
val copyCatalogConfig by registering(Copy::class) {
from("src/main/resources")
into("$rootDir/distribution/package/catalogs/hive/conf")
include("hive.conf")
include("hive-site.xml.template")
rename { original ->
if (original.endsWith(".template")) {
original.replace(".template", "")
} else {
original
}
}
exclude { details ->
details.file.isDirectory()
}
fileMode = 0b111101101
}
register("copyLibAndConfig", Copy::class) {
dependsOn(copyCatalogConfig, copyCatalogLibs)
}
}
tasks.test {
// Unit tests can create Hive clients without building this project's jar first.
dependsOn(
":catalogs:hive-metastore2-libs:jar",
":catalogs:hive-metastore3-libs:jar"
)
val skipITs = project.hasProperty("skipITs")
if (skipITs) {
// Exclude integration tests
exclude("**/integration/test/**")
} else {
dependsOn(tasks.jar)
}
}
tasks.getByName("generateMetadataFileForMavenJavaPublication") {
dependsOn("runtimeJars")
}