Код: Выделить всё
Caused by: java.lang.NoSuchMethodError: 'com.fasterxml.jackson.core.io.ContentReference com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createContentReference(java.lang.Object)'
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:441)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:15)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3413)
Версия плагина OpenAPI Generator: 6.0.0
Версия Jackson DataFormat YAML: пробовал как 2.14.2, так и 2.17. 1
Версия Java: 17
Версия Spring Boot: 3.x
Соответствующий фрагмент build.gradle:
Код: Выделить всё
plugins {
id 'java'
id 'org.openapi.generator' version '6.0.0'
}
repositories {
mavenCentral()
}
dependencies {
compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
}
sourceSets.main.java.srcDir "${buildDir}/generated/api-client"
configurations.all {
resolutionStrategy {
force 'com.fasterxml.jackson.core:jackson-core:2.14.2'
force 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
force 'com.fasterxml.jackson.core:jackson-annotations:2.14.2'
force 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2'
}
}
openApiGenerate {
generatorName.set('java')
inputSpec.set("$projectDir/src/main/resources/api-spec.yaml")
invokerPackage.set('com.example.client')
modelPackage.set('com.example.client.model')
apiPackage.set('com.example.client.api')
}
Код: Выделить всё
- Forcing different Jackson YAML versions (2.14.2, 2.15.0, 2.17.1),
but the error persists.
- Clearing the .gradle cache to ensure dependency resolution isn’t
affected by cached artifacts.
- Verifying that all Jackson dependencies are aligned in the same
version (2.14.2) to avoid compatibility issues.
Что может быть причиной этой ошибки NoSuchMethodError с методом _createContentReference в YAMLFactory и как ее устранить? Существует ли конкретная версия Jackson, совместимая с OpenAPI Generator 6.0.0 и Java 17?
Будем благодарны за любую информацию!
Подробнее здесь: https://stackoverflow.com/questions/791 ... -createcon