我尝试在Gradle项目中将Java版本从11更新到17。
更新后gradle-swagger-generator-plugin开始产生以下错误:
com.github.jknack.handlebars.HandlebarsException: /handlebars/JavaSpring/pojo.mustache:2:6: java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.Collections$EmptyMap.isEmpty() accessible: module java.base does not "opens java.util" to unnamed module @2f465398
Caused by: com.github.jknack.handlebars.HandlebarsException: /handlebars/JavaSpring/pojo.mustache:2:6: java.lang.reflect.InaccessibleObjectException: Unable to make public boolean java.util.Collections$EmptyMap.isEmpty() accessible: module java.base does not "opens java.util" to unnamed module @2f465398
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at com.github.jknack.handlebars.context.MemberValueResolver.cache(MemberValueResolver.java:82)
at com.github.jknack.handlebars.context.MemberValueResolver.resolve(MemberValueResolver.java:54)
...
at com.github.jknack.handlebars.internal.ForwardingTemplate.apply(ForwardingTemplate.java:72)
at io.swagger.codegen.v3.templates.HandlebarTemplateEngine.getRendered(HandlebarTemplateEngine.java:25)
at io.swagger.codegen.v3.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:735)
at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:392)
我的身材。
buildscript {
dependencies {
classpath('gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.19.2')
}
}
plugins {
...
id 'org.hidetake.swagger.generator' version '2.19.2'
}
我尝试了解决方案:https://github.com/swagger-api/swagger-codegen/issues/10966
buildscript {
dependencies {
classpath('gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.19.2')
classpath("com.github.jknack:handlebars:4.3.1") {
force: true
}
}
}
我还想加上
org.gradle.jvmargs=--add-opens java.base/java.util=ALL-UNNAMED
在梯度特性中
可惜什么都没变。
1条答案
按热度按时间iovurdzv1#
问题是旧版本的swagger-codegen-cli在我更换后
与
昂格发电厂