Sonar Gradle task fails with No such property: SNAKE_CASE for class: com.fasterxml.jackson.databind.PropertyNamingStrategy

5 days ago 11
ARTICLE AD BOX

I am running my project in vela and during the sonar task it is failing with No such property: SNAKE_CASE for class: com.fasterxml.jackson.databind.PropertyNamingStrategy

No where in the code base are we using propertynamingstrategy ( we are using propertynamingstrategies) and it builds successfully locally. This is happening when I am upgrading spring boot above 3.5.13, 3.5.12 and below works fine.

Here is the vela step where it is failing

- name: build ruleset: matcher: regexp branch: main|[0-9].x event: [ push, pull_request ] image: docker.xxx.com/toolshed/base-jdk:17-jdk-linux-amd64 secrets: [ sonar_token ] environment: GRADLE_USER_HOME: .gradle GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false commands: - adduser --disabled-password postgres - chown postgres "/vela/src" -R - sed -i -e "s/INSERT_TOKEN_HERE/$SONAR_TOKEN/g" gradle.properties - su postgres -c "export JAVA_HOME=/opt/java/openjdk; cd /vela/src/git.xxx.com/hesperides/${REPOSITORY_NAME}; ./gradlew clean build sonar"

Setup

Java 17

Gradle 8.x

SonarQube Gradle plugin 7.2.2

Jackson 2.21.x
Is this a known incompatibility with newer Jackson versions or Sonar plugins?

I have tried various debug steps to track down where this may be coming from without luck, and from what I could find none of our external libraries have a dependency on older versions of jackson below 2.19

Here is my build.gradle as well with the potentially relavent stuff

import com.github.spotbugs.snom.Confidence buildscript { dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" } } plugins { id "checkstyle" id "com.github.spotbugs" version 6.0.0 id "dev.projektor.publish" version 9.0.0 id "groovy" id "idea" id "io.spring.dependency-management" version 1.1.7 id "jacoco" id "java-library" id "maven-publish" id "org.sonarqube" version 7.2.2.6593 id "pmd" } apply plugin: "io.spring.dependency-management" apply plugin: "org.springframework.boot" ext\['netty.version'\] = 4.2.8.Final java { toolchain { languageVersion = JavaLanguageVersion.of(17) } withSourcesJar() } dependencies { developmentOnly 'org.springframework.boot:spring-boot-devtools' implementation "io.opentelemetry:opentelemetry-api:1.47.0" implementation "io.opentelemetry:opentelemetry-sdk-metrics:1.47.0" implementation "io.opentelemetry.instrumentation:opentelemetry-reactor-3.1:2.13.3-alpha" implementation "org.apache.groovy:groovy:4.0.26" implementation "org.springframework.boot:spring-boot-starter-actuator" implementation "org.springframework.boot:spring-boot-starter-aop" implementation "org.springframework.boot:spring-boot-starter-security" implementation "org.springframework.boot:spring-boot-starter-webflux" implementation "org.springframework.boot:spring-boot-starter-validation" implementation "org.springframework.kafka:spring-kafka" } configurations.implementation { exclude group: 'ch.qos.logback', module: 'logback-classic' exclude group: 'commons-logging', module: 'commons-logging' exclude group: 'io.micrometer', module: 'context-propagation' } /\* \* Copy gradle properties into the application properties so the app can find things like its own version \*/ processResources { filesMatching("application.properties") { expand(project.properties) } } /\* \* If there are java warnings, fail the build \*/ tasks.withType(JavaCompile).configureEach { options.compilerArgs \<\< "-Xlint:all" \<\< "-Xlint:-processing" \<\< "-Xlint:-serial" \<\< "-Werror" } /\* \* ------------------------------------------- \* Jacoco Configuration \* ------------------------------------------- \*/ jacoco { toolVersion = jacocoVersion reportsDirectory = layout.buildDirectory.dir("reports/jacoco") } /\* \* ------------------------------------------- \* PMD Configuration \* ------------------------------------------- \*/ tasks.withType(Pmd).configureEach { reports { xml.required = false html.required = true } } pmd { ignoreFailures = false sourceSets = \[project.sourceSets.main\] ruleSetFiles = files(new File(rootDir, "tools/pmd/pmd.xml")) ruleSets = \[\] toolVersion = pmdVersion } /\* \* ------------------------------------------- \* Projektor Configuration \* ------------------------------------------- \*/ projektor { serverUrl = "https://projektor.dev.xxx.com" } /\* \* ------------------------------------------- \* Sonarqube Configuration \* ------------------------------------------- \*/ sonarqube { properties { property "sonar.projectVersion", "1" property "sonar.sourceEncoding", "UTF-8" property "sonar.language", "java" property "sonar.verbose", "true" property "sonar.source", "src/main" property "sonar.java.coveragePlugin", "jacoco" property "sonar.jacoco.reportPath", "build/jacoco/test.exec" property "sonar.forceAnalysis", "true" property "sonar.dependencyCheck.skip", "true" property "buildbreaker.skip", "false" property "exclusions", "src/test/\*\*" property "sonar.host.url", "https://sonarqubehesp.dev.xxx.com/" } } /\* \* ------------------------------------------- \* Spotbugs Configuration \* ------------------------------------------- \*/ spotbugs { // see bug here https://github.com/spotbugs/spotbugs-gradle-plugin/issues/972#issuecomment-2312166517 // 3: HIGH reportLevel = Confidence.values()\[3\] excludeFilter = file("$rootProject.projectDir/tools/spotbugs/spotbugs-exclude.xml") reportsDir = file("$rootProject.projectDir/reports/spotbugs/main/spotbugs.html") } tasks.named('spotbugsTest') { enabled = false } /\* \* ------------------------------------------- \* Test Configuration \* ------------------------------------------- \*/ test { useJUnitPlatform() } // run pmd and spotbugs before test test.dependsOn 'pmdMain' test.dependsOn 'spotbugsMain' test.dependsOn 'spotbugsTest'

The full console error in vela

\\\> Task :sonarBoth 'sonar.login' and 'sonar.token' (or the 'SONAR_TOKEN' env variable) are set, but only the latter will be used.Use of 'sonar.login' property has been deprecated in favor of 'sonar.token' (or the env variable alternative 'SONAR_TOKEN'). Please use the latter when passing a token.\[stderr\] Picked up JAVA_TOOL_OPTIONS: -javaagent:/app/otel-xxx-extensions.jar\[stderr\] OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended\[stderr\] Picked up JAVA_TOOL_OPTIONS: -javaagent:/app/otel-xxx-extensions.jar\[stderr\] OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appendedThe property 'sonar.login' is deprecated and will be removed in the future. Please use the 'sonar.token' property instead when passing a token.Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.Use of preview features have been detected during analysis. Enable DEBUG mode to see them.Property 'sonar.jacoco.reportPath' is no longer supported. Use JaCoCo's xml report and sonar-jacoco plugin.View Projektor report at: https://projektor.dev.xxx.com/tests/OJJ3W4FORXAHFAILURE: Build failed with an exception.\* What went wrong:No such property: SNAKE_CASE for class: com.fasterxml.jackson.databind.PropertyNamingStrategy
Read Entire Article