英文:
Openapitools does not work anymore after update from springboot 2.x to springboot 3.1.0
问题
当执行 gradle 任务 openApiGenerate 时,会出现以下错误:
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:479)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:15)
at com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1164)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3742)
at org.openapitools.codegen.serializer.SerializerUtils.toYamlString(SerializerUtils.java:38)
at org.openapitools.codegen.DefaultCodegen.generateYAMLSpecFile(DefaultCodegen.java:7094)
at org.openapitools.codegen.languages.JavaClientCodegen.postProcessSupportingFileData(JavaClientCodegen.java:1129)
at org.openapitools.codegen.DefaultGenerator.buildSupportFileBundle(DefaultGenerator.java:814)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:917)
我尝试降级 jackson,但仍然出现相同的错误(尽管依赖树显示使用了旧版本)。
该任务定义如下:
openApiGenerate {
generatorName = "java"
inputSpec = "$projectDir/$openApiDir"
outputDir = "$buildDir"
library = "template"
apiPackage = "myapi.api"
modelPackage = "mymodel.model"
invokerPackage = "myinvoker.invoker"
generateModelTests = false
generateApiTests = false
generateApiDocumentation = false
generateModelDocumentation = false
configOptions = [
useSpringBoot3: "true",
sourceFolder: "$generatedBaseDir",
]
}
有一些建议如何修复这个错误?
英文:
When the gradle task openApiGenerate is executed the following error occurs:
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:479)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:15)
at com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1164)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3742)
at org.openapitools.codegen.serializer.SerializerUtils.toYamlString(SerializerUtils.java:38)
at org.openapitools.codegen.DefaultCodegen.generateYAMLSpecFile(DefaultCodegen.java:7094)
at org.openapitools.codegen.languages.JavaClientCodegen.postProcessSupportingFileData(JavaClientCodegen.java:1129)
at org.openapitools.codegen.DefaultGenerator.buildSupportFileBundle(DefaultGenerator.java:814)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:917)
I tried to downgrade jackson but still the same error (although dependency tree says that the older version is used).
The task is defined like this:
openApiGenerate {
generatorName = "java"
inputSpec = "$projectDir/$openApiDir"
outputDir = "$buildDir"
library = "template"
apiPackage = "myapi.api"
modelPackage = "mymodel.model"
invokerPackage = "myinvoker.invoker"
generateModelTests = false
generateApiTests = false
generateApiDocumentation = false
generateModelDocumentation = false
configOptions = [
useSpringBoot3: "true",
sourceFolder: "$generatedBaseDir",
]
}
Some hints how to fix the error?
答案1
得分: 0
Error occurs only if an other plugin is imported that uses a newer version of com.fasterxml.jackson.core.*
英文:
Error occurs only if an other plugin is imported that uses a newer version of com.fasterxml.jackson.core.*
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论