|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar |
| 20 | + |
| 21 | +plugins { |
| 22 | + `maven-publish` |
| 23 | + id("java") |
| 24 | + alias(libs.plugins.shadow) |
| 25 | +} |
| 26 | + |
| 27 | +dependencies { |
| 28 | + compileOnly(project(":api")) |
| 29 | + compileOnly(project(":catalogs:catalog-common")) |
| 30 | + compileOnly(project(":catalogs:catalog-hadoop")) |
| 31 | + compileOnly(project(":core")) |
| 32 | + compileOnly(libs.hadoop3.client.api) |
| 33 | + compileOnly(libs.hadoop3.client.runtime) |
| 34 | + compileOnly(libs.hadoop3.oss) |
| 35 | + |
| 36 | + implementation(project(":catalogs:catalog-common")) { |
| 37 | + exclude("*") |
| 38 | + } |
| 39 | + implementation(project(":catalogs:hadoop-common")) { |
| 40 | + exclude("*") |
| 41 | + } |
| 42 | + |
| 43 | + implementation(libs.aliyun.credentials.sdk) |
| 44 | + implementation(libs.commons.collections3) |
| 45 | + |
| 46 | + // oss needs StringUtils from commons-lang3 or the following error will occur in 3.3.0 |
| 47 | + // java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils |
| 48 | + // org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystemStore.initialize(AliyunOSSFileSystemStore.java:111) |
| 49 | + // org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem.initialize(AliyunOSSFileSystem.java:323) |
| 50 | + // org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3611) |
| 51 | + implementation(libs.commons.lang3) |
| 52 | + implementation(libs.guava) |
| 53 | + |
| 54 | + implementation(libs.httpclient) |
| 55 | + implementation(libs.jackson.databind) |
| 56 | + implementation(libs.jackson.annotations) |
| 57 | + implementation(libs.jackson.datatype.jdk8) |
| 58 | + implementation(libs.jackson.datatype.jsr310) |
| 59 | + |
| 60 | + // Aliyun oss SDK depends on this package, and JDK >= 9 requires manual add |
| 61 | + // https://www.alibabacloud.com/help/en/oss/developer-reference/java-installation?spm=a2c63.p38356.0.i1 |
| 62 | + implementation(libs.sun.activation) |
| 63 | +} |
| 64 | + |
| 65 | +tasks.withType(ShadowJar::class.java) { |
| 66 | + isZip64 = true |
| 67 | + configurations = listOf(project.configurations.runtimeClasspath.get()) |
| 68 | + archiveClassifier.set("") |
| 69 | + mergeServiceFiles() |
| 70 | + |
| 71 | + // Relocate dependencies to avoid conflicts |
| 72 | + relocate("org.jdom", "org.apache.gravitino.aliyun.shaded.org.jdom") |
| 73 | + relocate("org.apache.commons.lang3", "org.apache.gravitino.aliyun.shaded.org.apache.commons.lang3") |
| 74 | + relocate("com.fasterxml.jackson", "org.apache.gravitino.aliyun.shaded.com.fasterxml.jackson") |
| 75 | + relocate("com.google.common", "org.apache.gravitino.aliyun.shaded.com.google.common") |
| 76 | + relocate("org.apache.http", "org.apache.gravitino.aliyun.shaded.org.apache.http") |
| 77 | + relocate("org.apache.commons.collections", "org.apache.gravitino.aliyun.shaded.org.apache.commons.collections") |
| 78 | +} |
| 79 | + |
| 80 | +tasks.jar { |
| 81 | + dependsOn(tasks.named("shadowJar")) |
| 82 | + archiveClassifier.set("empty") |
| 83 | +} |
| 84 | + |
| 85 | +tasks.compileJava { |
| 86 | + dependsOn(":catalogs:catalog-hadoop:runtimeJars") |
| 87 | +} |
0 commit comments