From c4d4554b2bb0e9630b2e0366d0d3a6974b2dd9ae Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Tue, 2 Jul 2024 10:12:47 +0200 Subject: [PATCH] Fix incompatible jackson libs pulled by beam-sdks-java-io-google-cloud-platform (#5401) --- build.sbt | 10 ++++++++++ project/Exclude.scala | 16 +++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 335798ee0d..cccabe4508 100644 --- a/build.sbt +++ b/build.sbt @@ -32,6 +32,7 @@ val beamVersion = "2.56.0" // check version used by beam // https://github.com/apache/beam/blob/v2.56.0/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +val arrowVersion = "15.0.1" val autoServiceVersion = "1.0.1" val autoValueVersion = "1.9" val bigdataossVersion = "2.2.16" @@ -883,6 +884,11 @@ lazy val `scio-google-cloud-platform` = project .settings(beamRunnerSettings) .settings( description := "Scio add-on for Google Cloud Platform", + unusedCompileDependenciesFilter -= Seq( + // required for patching jackson version pulled by arrow + moduleFilter("org.apache.arrow", "arrow-vector"), + moduleFilter("com.fasterxml.jackson.datatype", "jackson-datatype-jsr310") + ).reduce(_ | _), libraryDependencies ++= Seq( // compile "com.esotericsoftware" % "kryo-shaded" % kryoVersion, @@ -924,6 +930,9 @@ lazy val `scio-google-cloud-platform` = project "org.apache.beam" % "beam-sdks-java-io-google-cloud-platform" % beamVersion excludeAll (Exclude.avro), "org.apache.beam" % "beam-vendor-guava-32_1_2-jre" % beamVendorVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, + // patch jackson versions + "org.apache.arrow" % "arrow-vector" % arrowVersion excludeAll (Exclude.jacksons: _*), + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonVersion, // test "com.google.cloud" % "google-cloud-storage" % googleCloudStorageVersion % Test, "com.spotify" %% "magnolify-cats" % magnolifyVersion % Test, @@ -1788,6 +1797,7 @@ ThisBuild / dependencyOverrides ++= Seq( "com.fasterxml.jackson.core" % "jackson-annotations" % jacksonVersion, "com.fasterxml.jackson.core" % "jackson-core" % jacksonVersion, "com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion, + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonVersion, "com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion, "com.github.luben" % "zstd-jni" % zstdJniVersion, "com.google.api" % "api-common" % googleApiCommonVersion, diff --git a/project/Exclude.scala b/project/Exclude.scala index c86d01334d..d60cbd5074 100644 --- a/project/Exclude.scala +++ b/project/Exclude.scala @@ -2,14 +2,20 @@ import sbt._ object Exclude { // do not pull newer avro version - val avro = "org.apache.avro" % "avro" - val gcsio = "com.google.cloud.bigdataoss" % "gcsio" + val avro: ExclusionRule = "org.apache.avro" % "avro" + val gcsio: ExclusionRule = "com.google.cloud.bigdataoss" % "gcsio" + // do not pull newer jackson version + val jacksons: Seq[ExclusionRule] = Seq( + ExclusionRule("com.fasterxml.jackson.core"), + ExclusionRule("com.fasterxml.jackson.datatype"), + ExclusionRule("com.fasterxml.jackson.module") + ) // replaced by io.dropwizard.metrics metrics-core - val metricsCore = "com.codahale.metrics" % "metrics-core" + val metricsCore: ExclusionRule = "com.codahale.metrics" % "metrics-core" // kafka isn't exposed in scio and pulling too many things - val beamKafka = "org.apache.beam" % "beam-sdks-java-io-kafka" + val beamKafka: ExclusionRule = "org.apache.beam" % "beam-sdks-java-io-kafka" // logger implementation must be given by the runner lib - val loggerImplementations = Seq( + val loggerImplementations: Seq[ExclusionRule] = Seq( "ch.qos.logback" % "logback-classic", "ch.qos.logback" % "logback-core", "ch.qos.reload4j" % "reload4j",