This message was deleted.
# community-support
s
This message was deleted.
c
what do the dependency declarations look like for jackson (incl. the bom)?
e
Copy code
jacksonVersion = "2.12.7"
    . . .
    implementation "com.fasterxml.jackson.module:jackson-module-scala_2.13:${jacksonVersion}"
We do not define the bom anywhere as a dependency, so its a transitive dependency from somewhere
c
possible to share a build scan?
e
c
thanks. Generally cleanest to use the BOM to ensure that versions are aligned. For example:
Copy code
implementation(platform("com.fasterxml.jackson:jackson-bom:$jacksonVersion"))
implementation("com.fasterxml.jackson.module:jackson-module-scala_2.13")
e
Ahhhh... I will try that
c
that scala jackson module oddly has a version in the name - there’s a properly named/version one.
implementation("com.fasterxml.jackson.module:jackson-module-scala")
not clear that’s your issue, but will lead to future footguns.
e
That's a scala thing...
c
my scala knowledge is minimal. Seems odd.
e
I will explain later...
c
no worries. Happy to keep my scala knowledge right where it is 😉
another observation: there’s quite a range of transitive Jackson versions. 2.10.4, 2.12.5, 2.12.6, 2.12.7, 2.13.4. Many of those libraries pulling those in should be upgraded (elasticsearch, avro, dropwizard, etc).
e
Copy code
// Jackson Json Serialization
    implementation(platform("com.fasterxml.jackson:jackson-bom:${jacksonVersion}"))
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jacksonVersion}"
    implementation "com.fasterxml.jackson.module:jackson-module-parameter-names:${jacksonVersion}"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}"
    implementation "com.fasterxml.jackson.module:jackson-module-scala_2.13:${jacksonVersion}"
but I am still getting the same errors... Do you want another scan? Yes, the Jackson family is a bunch of unruly hillbillies...
c
when using a bom there’s no need to define the versions in each artifact (the BOM supplies the version).
Copy code
implementation(platform("com.fasterxml.jackson:jackson-bom:${jacksonVersion}"))
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8"
implementation "com.fasterxml.jackson.module:jackson-module-parameter-names"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
implementation "com.fasterxml.jackson.module:jackson-module-scala_2.13"
1
e
Because different versions of Scala are not backwards compatible, Scala appends the major version to libraries
c
ah, i see. that’s a scala version, that coincidentally is very similar to a Jackson one. ok.
e
Copy code
% ./gradlew compileJava
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find com.fasterxml.jackson:jackson-bom:2.13.4.1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://oss.sonatype.org/content/repositories/snapshots/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
     Required by:
         project :
   > Could not find com.fasterxml.jackson.datatype:jackson-datatype-jdk8:.
     Required by:
         project :
   > Could not find com.fasterxml.jackson.module:jackson-module-parameter-names:.
     Required by:
         project :
   > Could not find com.fasterxml.jackson.datatype:jackson-datatype-jsr310:.
     Required by:
         project :
   > Could not find com.fasterxml.jackson:jackson-bom:2.13.4.1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://oss.sonatype.org/content/repositories/snapshots/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
     Required by:
         project : > org.apache.spark:spark-core_2.13:3.3.1 > com.fasterxml.jackson.core:jackson-databind:2.13.4.1
   > Could not find com.fasterxml.jackson:jackson-bom:2.13.4.1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://oss.sonatype.org/content/repositories/snapshots/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
     Required by:
         project : > com.fasterxml.jackson.module:jackson-module-scala_2.13:2.13.4 > com.fasterxml.jackson.core:jackson-core:2.13.4
         project : > com.fasterxml.jackson.module:jackson-module-scala_2.13:2.13.4 > com.fasterxml.jackson.core:jackson-annotations:2.13.4
c
ok. let’s grab a scan for this pls.
e
c
ok, let’s start with cleaning up the datatype stuff:
Copy code
// the 'datatype' modules have been replaced
//implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8"
//implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"

implementation "com.fasterxml.jackson.module:jackson-datatype-jdk8"
implementation "com.fasterxml.jackson.module:jackson-datatype-jsr310"
…that will allow those to be resolved via the BOM.
won’t fix everything, but will reduce noise…
ugh. apologies, conflicting information. The original ones were correctly specified (but not resolving for some reason).
Copy code
implementation "com.fasterxml.jackson.datatypejackson-datatype-jdk8"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
e
ahh
c
can you check the spec for those dependencies - perhaps that have a trailing ‘:’ (that should be removed).
c
yep. believe it’s in the build script like this:
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:
(note the trailing
:
that prevents using the BOM version).
e
I should use a trailing
:
?
c
no. remove that.
e
It was never there
c
ok. that is odd. checking the BOM, it should pull those in.
OR, preferably, import Jackson BOM that will specify consistent version set.
e
What does that look like in Gradle?
c
This works in a minimal Gradle build script:
Copy code
repositories {
    mavenCentral()
}
dependencies {
    val jacksonVersion = "2.12.7"
        implementation(platform("com.fasterxml.jackson:jackson-bom:$jacksonVersion"))
    implementation("com.fasterxml.jackson.module:jackson-module-parameter-names")
    implementation("com.fasterxml.jackson.module:jackson-module-scala_2.13")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
can you check the artifacts / version against what you have.
(that’s Kotlin syntax - aside from
val
everything else should go straight across to groovy)
This is how it looks for a working Gradle resolution w/ the BOM
From your build scan; note it isn’t showing the platform or constraints.
e
Copy code
// Jackson Json Serialization
    implementation platform("com.fasterxml.jackson:jackson-bom:2.12.7")
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
    implementation "com.fasterxml.jackson.module:jackson-module-parameter-names"
    implementation "com.fasterxml.jackson.module:jackson-module-scala_2.13"
still fails (Groovy)
c
yes - but there are two different failures in there. One where the Jackson modules fail to resolve, and a second where the BOM fails to resolve. Are both failures still present?
Need to figure out why it isn’t behaving as expected wrt BOMs.
e
Copy code
% ./gradlew compileJava
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find com.fasterxml.jackson:jackson-bom:2.13.4.1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://oss.sonatype.org/content/repositories/snapshots/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
     Required by:
         project :
   > Could not find com.fasterxml.jackson.datatype:jackson-datatype-jdk8:.
     Required by:
         project :
   > Could not find com.fasterxml.jackson.datatype:jackson-datatype-jsr310:.
     Required by:
         project :
   > Could not find com.fasterxml.jackson.module:jackson-module-parameter-names:.
     Required by:
         project :
   > Could not find com.fasterxml.jackson:jackson-bom:2.13.4.1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://oss.sonatype.org/content/repositories/snapshots/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
     Required by:
         project : > org.apache.spark:spark-core_2.13:3.3.1 > com.fasterxml.jackson.core:jackson-databind:2.13.4.1
   > Could not find com.fasterxml.jackson:jackson-bom:2.13.4.1.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
       - <https://oss.sonatype.org/content/repositories/snapshots/com/fasterxml/jackson/jackson-bom/2.13.4.1/jackson-bom-2.13.4.1.pom>
     Required by:
         project : > com.fasterxml.jackson.module:jackson-module-scala_2.13:2.13.4 > com.fasterxml.jackson.core:jackson-core:2.13.4
         project : > com.fasterxml.jackson.module:jackson-module-scala_2.13:2.13.4 > com.fasterxml.jackson.core:jackson-annotations:2.13.4
c
can’t tell from that - scan?
e
c
yea, it’s not pulling in that platform. are there other things in the build script that mess with dependency constraints etc?
fyi, this minimal repro works (same Gradle version).
Copy code
plugins {
    `java-library`
}

repositories {
    mavenCentral()
}
dependencies {
    // Jackson Json Serialization
    implementation(platform("com.fasterxml.jackson:jackson-bom:2.12.7"))
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
    implementation("com.fasterxml.jackson.module:jackson-module-parameter-names")
    implementation("com.fasterxml.jackson.module:jackson-module-scala_2.13")
}
e
Copy code
plugins {
    id 'groovy'
    id 'java'
}

group 'com.forgerock.autoid'
version '1.0-SNAPSHOT'

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(11))
    }
}

ext {
    immutablesVersion = "2.8.8"
    findBugsJsrVersion = "3.0.2"
    groovyVersion = "3.0.3"
    spockVersion = "2.0-M3-groovy-3.0"
    jacksonVersion = "2.12.7"
    slf4jVersion = "1.7.30"
    log4j2Version = "2.17.1"
    sparkCoreVersion = "3.3.1"
    elasticVersion = "7.12.1"
    commonsLangVersion = "3.11"
    jerseyClientVersion = "2.33"
    apacheHttpVersion = "4.5.13"
}

repositories {
    mavenCentral()
    gradlePluginPortal()
    // Spock snapshots are available from the Sonatype OSS snapshot repository
    maven { url "<https://oss.sonatype.org/content/repositories/snapshots/>" }
}

dependencies {
    // Immutables
    annotationProcessor "org.immutables:value:${immutablesVersion}"
    annotationProcessor "org.immutables:builder:${immutablesVersion}"
    compileOnly "org.immutables:value:${immutablesVersion}"
    compileOnly "org.immutables:builder:${immutablesVersion}"
    // @Nullable annotations in immutables
    implementation "com.google.code.findbugs:jsr305:${findBugsJsrVersion}"

    // Jackson Json Serialization
    //implementation group: 'com.fasterxml.jackson', name: 'jackson-bom', version: '2.12.7', ext: 'pom'
    implementation platform("com.fasterxml.jackson:jackson-bom:2.12.7")
    // implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8'
    // implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310'
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
    implementation "com.fasterxml.jackson.module:jackson-module-parameter-names"
    implementation "com.fasterxml.jackson.module:jackson-module-scala_2.13"

    // SLF4j
//    implementation "org.slf4j:slf4j-api:${slf4jVersion}"
//    implementation "org.apache.logging.log4j:log4j-slf4j18-impl:${log4j2Version}"

    // Spark
    compileOnly "org.apache.spark:spark-core_2.13:${sparkCoreVersion}"
    compileOnly "org.apache.spark:spark-sql_2.13:${sparkCoreVersion}"

    // ElasticSearch
    implementation "org.elasticsearch.client:elasticsearch-rest-high-level-client:${elasticVersion}"

    //Apache commons lang
    implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
    implementation "org.apache.httpcomponents:httpclient:${apacheHttpVersion}"

    //Jersey client
    implementation "org.glassfish.jersey.core:jersey-client:${jerseyClientVersion}"
    implementation "org.glassfish.jersey.inject:jersey-hk2:${jerseyClientVersion}"
    implementation "org.glassfish.jersey.media:jersey-media-json-processing:${jerseyClientVersion}"
    implementation "org.glassfish.jersey.media:jersey-media-json-binding:${jerseyClientVersion}"

    // Mandatory dependencies for using Spock
    testImplementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
    testImplementation platform("org.spockframework:spock-bom:${spockVersion}")
    testImplementation "org.spockframework:spock-core"
    // Spark in tests
    testImplementation "org.apache.spark:spark-core_2.13:${sparkCoreVersion}"
    testImplementation "org.apache.spark:spark-sql_2.13:${sparkCoreVersion}"
}

test {
    useJUnitPlatform()
}
c
thanks. dropped that into repro build script and can now reproduce the issue.
🙌 1
this is the culprit, not sure why yet:
Copy code
compileOnly("org.apache.spark:spark-core_2.13:${sparkCoreVersion}")
e
I suspected as much... but was not sure...
Spark is Scala based
Maybe use an older version?
Or exclude the other bom?
c
it appears to be the spark dependency on avro that is pulling in a bad Jackson bom. standby…
👀 1
so it works with spark 3.3.0, but not with 3.3.1.
e
Let me try...
🥳
Wow....
Is there a way to specifically exclude the bad bom?
c
unclear what, specifically, inside of that Spark version is bad. let me try something…
Adding this in the dependencies block fixes it:
Copy code
constraints {
        implementation("com.fasterxml.jackson:jackson-bom") {
            version {
                strictly("2.13.4")
            }
        }
e
In the
build.gradle
? Is that Kotlin or Groovy?
c
either Kotlin or Groovy. Yep, in build.gradle.
e
Okay, waiting for our CI/CD pipeline... to see how many problems get fixed...
Okay, I think we have solved this problem now... I am really grateful for your help... thanks Now I have other problems to solve...
c
good stuff, and good luck!