2

在 jenkins 共享库管道中使用 swagger 解析器时出现此错误

Groovy 葡萄抓斗:

@Grab('io.swagger:swagger-parser:2.0.0-rc1')
@Grab(group='com.fasterxml.jackson.core', module='jackson-databind', version='2.9.1')
@Grab(group='com.fasterxml.jackson.dataformat', module='jackson-dataformat-yaml', version='2.9.1')
@Grab('org.apache.httpcomponents:httpclient:4.5.5')
@Grab('org.yaml:snakeyaml:1.18')

堆栈跟踪:

 java.lang.VerifyError: Bad type on operand stack
 Exception Details:
 Location:
    v2/io/swagger/util/ObjectMapperFactory.createYaml(ZZ)Lcom/fasterxml/jackson/databind/ObjectMapper; @9: invokestatic
Reason:
    Type 'com/fasterxml/jackson/dataformat/yaml/YAMLFactory' (current frame, stack[0]) is not assignable to 'com/fasterxml/jackson /core/JsonFactory'
Current Frame:
bci: @9
flags: { }
locals: { integer, integer }
stack: { 'com/fasterxml/jackson/dataformat/yaml/YAMLFactory', integer, integer }
Bytecode:
0x0000000: bb00 2159 b700 221a 1bb8 0019 b0       

at v2.io.swagger.util.Json.mapper(Json.java:13)
at v2.io.swagger.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:61)
at v2.io.swagger.parser.Swagger20Parser.convertToSwagger(Swagger20Parser.java:121)
at v2.io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:105)
at v2.io.swagger.parser.SwaggerParser.read(SwaggerParser.java:65)
at v2.io.swagger.parser.SwaggerParser.read(SwaggerParser.java:54)
4

0 回答 0