从 JDK 8 迁移到 JDK 17 。 CXF Codegen 插件导致问题

问题描述 投票:0回答:0

当前使用 SPring boot 3 迁移到 JDK 17 并将 CXF 升级到 4.0.2,但出现错误。 还将 javaws import 更新为 jakarta import。

Exception in thread "main" org.apache.cxf.tools.common.ToolException: XJC reported 'BadCommandLineException' for -xjc argument:-extension -Xbgi -target 2.1 
Available plugin options:
  -Xbg                 : Generate getters methods for Booleans
  -Xbgi                 : Generate getXXX and isXXX methods for Booleans
  -Xinject-code       :  inject specified Java code fragments into the generated code
  -Xlocator           :  enable source location support for generated code
  -Xsync-methods      :  generate accessor methods with the 'synchronized' keyword
  -mark-generated     :  mark the generated code as @jakarta.annotation.Generated
                      -noDate            : do not add date
                      -Xann <annotation> : generate <annotation> instead of @jakarta.annotation.Generated
  -episode <FILE>     :  generate the episode file for separate compilation
  -Xpropertyaccessors :  Use XmlAccessType PROPERTY instead of FIELD for generated classes
  -XBeanVal           :  convert xsd restrictions to jakarta.validation annotations. Usage with mods: -XBeanVal jsr303 simpleRegex
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:426)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:711)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:259)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java.main(ForkOnceWSDL2Java.java:51)
Caused by: com.sun.tools.xjc.BadCommandLineException: "2.1" is not a valid target version. "3.0" is supported.
    at com.sun.tools.xjc.Options.parseArgument(Options.java:617)
    at com.sun.tools.xjc.Options.parseArguments(Options.java:853)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:410)
    ... 8 more

如何解决此错误。

java cxf java-17 wsdl2java spring-boot-3
© www.soinside.com 2019 - 2024. All rights reserved.