Skip to content

Commit

Permalink
Build: Fix Gradle issue for consuming projects with Maven classifier (#…
Browse files Browse the repository at this point in the history
…8588)

For some reason, Gradle has issues to detect the maven classifier
properly in a consuming project from Gradle metadata.

The issue has been reported in
https://youtrack.jetbrains.com/issue/IDEA-327421/IJ-fails-to-import-Gradle-project-with-dependency-with-classifier
and in gradle/gradle#15756.

I'm able to verify that this workaround fixes the issue for consuming
projects.
  • Loading branch information
nastra authored Sep 20, 2023
1 parent e88d0f4 commit a6e2459
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 95 deletions.
15 changes: 3 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,7 @@ project(':iceberg-data') {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down Expand Up @@ -681,10 +678,7 @@ project(':iceberg-hive-metastore') {
// that's really old. We use the core classifier to be able to override our guava
// version. Luckily, hive-exec seems to work okay so far with this version of guava
// See: https://github.com/apache/hive/blob/master/ql/pom.xml#L911 for more context.
testImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
testImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down Expand Up @@ -734,10 +728,7 @@ project(':iceberg-orc') {
exclude group: 'org.tukaani' // xz compression is not supported
}

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down
21 changes: 4 additions & 17 deletions flink/v1.15/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {
// for dropwizard histogram metrics implementation
compileOnly libs.flink115.metrics.dropwizard
compileOnly libs.flink115.streaming.java
compileOnly(libs.flink115.streaming.java) {
artifact {
classifier = 'tests'
}
}
compileOnly "${libs.flink115.streaming.java.get().module}:${libs.flink115.streaming.java.get().getVersion()}:tests"
compileOnly libs.flink115.table.api.java.bridge
compileOnly "org.apache.flink:flink-table-planner_${scalaVersion}:${libs.versions.flink115.get()}"
compileOnly libs.flink115.connector.base
Expand All @@ -61,10 +57,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {

compileOnly libs.avro.avro

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down Expand Up @@ -92,10 +85,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {
// that's really old. We use the core classifier to be able to override our guava
// version. Luckily, hive-exec seems to work okay so far with this version of guava
// See: https://github.com/apache/hive/blob/master/ql/pom.xml#L911 for more context.
testImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
testImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down Expand Up @@ -209,10 +199,7 @@ project(":iceberg-flink:iceberg-flink-runtime-${flinkMajorVersion}") {
exclude group: 'com.zaxxer', module: 'HikariCP'
}

integrationImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
integrationImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down
21 changes: 4 additions & 17 deletions flink/v1.16/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {
// for dropwizard histogram metrics implementation
compileOnly libs.flink116.metrics.dropwizard
compileOnly libs.flink116.streaming.java
compileOnly(libs.flink116.streaming.java) {
artifact {
classifier = 'tests'
}
}
compileOnly "${libs.flink116.streaming.java.get().module}:${libs.flink116.streaming.java.get().getVersion()}:tests"
compileOnly libs.flink116.table.api.java.bridge
compileOnly "org.apache.flink:flink-table-planner_${scalaVersion}:${libs.versions.flink116.get()}"
compileOnly libs.flink116.connector.base
Expand All @@ -61,10 +57,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {

compileOnly libs.avro.avro

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down Expand Up @@ -92,10 +85,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {
// that's really old. We use the core classifier to be able to override our guava
// version. Luckily, hive-exec seems to work okay so far with this version of guava
// See: https://github.com/apache/hive/blob/master/ql/pom.xml#L911 for more context.
testImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
testImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down Expand Up @@ -209,10 +199,7 @@ project(":iceberg-flink:iceberg-flink-runtime-${flinkMajorVersion}") {
exclude group: 'com.zaxxer', module: 'HikariCP'
}

integrationImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
integrationImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down
21 changes: 4 additions & 17 deletions flink/v1.17/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {
// for dropwizard histogram metrics implementation
compileOnly libs.flink117.metrics.dropwizard
compileOnly libs.flink117.streaming.java
compileOnly(libs.flink117.streaming.java) {
artifact {
classifier = 'tests'
}
}
compileOnly "${libs.flink117.streaming.java.get().module}:${libs.flink117.streaming.java.get().getVersion()}:tests"
compileOnly libs.flink117.table.api.java.bridge
compileOnly "org.apache.flink:flink-table-planner_${scalaVersion}:${libs.versions.flink117.get()}"
compileOnly libs.flink117.connector.base
Expand All @@ -61,10 +57,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {

compileOnly libs.avro.avro

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down Expand Up @@ -92,10 +85,7 @@ project(":iceberg-flink:iceberg-flink-${flinkMajorVersion}") {
// that's really old. We use the core classifier to be able to override our guava
// version. Luckily, hive-exec seems to work okay so far with this version of guava
// See: https://github.com/apache/hive/blob/master/ql/pom.xml#L911 for more context.
testImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
testImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down Expand Up @@ -209,10 +199,7 @@ project(":iceberg-flink:iceberg-flink-runtime-${flinkMajorVersion}") {
exclude group: 'com.zaxxer', module: 'HikariCP'
}

integrationImplementation(libs.hive2.exec) {
artifact {
classifier = 'core'
}
integrationImplementation("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'org.apache.avro', module: 'avro'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.pentaho' // missing dependency
Expand Down
10 changes: 2 additions & 8 deletions hive3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ project(':iceberg-hive3') {
exclude group: 'org.apache.avro', module: 'avro'
}

compileOnly(libs.hive3.exec) {
artifact {
classifier = 'core'
}
compileOnly("${libs.hive3.exec.get().module}:${libs.hive3.exec.get().getVersion()}:core") {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.guava'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
Expand All @@ -65,10 +62,7 @@ project(':iceberg-hive3') {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}

compileOnly(libs.orc.core) {
artifact {
classifier = 'nohive'
}
compileOnly("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down
5 changes: 1 addition & 4 deletions mr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ project(':iceberg-mr') {
exclude group: 'org.apache.avro', module: 'avro'
}

compileOnly(libs.hive2.exec) {
artifact {
classifier = 'core'
}
compileOnly("${libs.hive2.exec.get().module}:${libs.hive2.exec.get().getVersion()}:core") {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.guava'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
Expand Down
5 changes: 1 addition & 4 deletions spark/v3.1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ project(':iceberg-spark:iceberg-spark-3.1_2.12') {
implementation libs.parquet.column
implementation libs.parquet.hadoop

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down
5 changes: 1 addition & 4 deletions spark/v3.2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") {
implementation libs.parquet.column
implementation libs.parquet.hadoop

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down
5 changes: 1 addition & 4 deletions spark/v3.3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") {
implementation libs.parquet.column
implementation libs.parquet.hadoop

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down
5 changes: 1 addition & 4 deletions spark/v3.4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") {
implementation libs.parquet.column
implementation libs.parquet.hadoop

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down
5 changes: 1 addition & 4 deletions spark/v3.5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ project(":iceberg-spark:iceberg-spark-${sparkMajorVersion}_${scalaVersion}") {
implementation libs.parquet.column
implementation libs.parquet.hadoop

implementation(libs.orc.core) {
artifact {
classifier = 'nohive'
}
implementation("${libs.orc.core.get().module}:${libs.versions.orc.get()}:nohive") {
exclude group: 'org.apache.hadoop'
exclude group: 'commons-lang'
// These artifacts are shaded and included in the orc-core fat jar
Expand Down

0 comments on commit a6e2459

Please sign in to comment.