小编Ach*_*ari的帖子

为什么使用 cxf-xjc-plugin 从 xsd 生成代码 (java) 在 jdk 11 (amazon) 上不起作用,但在 java 8 上却起作用

我将一个项目从 迁移Java 8Java 11,并且在XSD使用生成代码时遇到了一些麻烦cxf-xjc-plugin.

即使我确实升级到了cxf-xjc-plugin版本3.3.0,在构建项目时仍然遇到异常

我的pom.xml

       ...
           <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-xjc-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <extensions>
                        <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
                    </extensions>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>xsdtojava</goal>
                        </goals>
                        <configuration>
                            <sourceRoot>${basedir}/target/generated-sources/xjc</sourceRoot>
                            <xsdOptions>
                                <xsdOption>
                                    <xsd>src/main/resources/xsd/leehwak.xsd</xsd>
                                    <packagename>fr.lee.hwak.batch.input</packagename>
                                    <extensionArgs>
                                        <arg>-encoding</arg>
                                        <arg>UTF-8</arg>
                                    </extensionArgs>
                                </xsdOption>
                            </xsdOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        ...
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪

[ERROR] C:\Users\Achraf\IdeaProjects\lee\lee-batch\target\null [-1:-1]: Failed to create model
com.sun.istack.SAXParseException2; Failed to create model
    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:64)
    at org.apache.cxf.maven_plugin.XSDToJavaRunner.loadModel(XSDToJavaRunner.java:241)
    at org.apache.cxf.maven_plugin.XSDToJavaRunner.run(XSDToJavaRunner.java:177)
    at org.apache.cxf.maven_plugin.XSDToJavaRunner.main(XSDToJavaRunner.java:375)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at …
Run Code Online (Sandbox Code Playgroud)

java maven-plugin cxf-xjc-plugin

5
推荐指数
1
解决办法
5037
查看次数

标签 统计

cxf-xjc-plugin ×1

java ×1

maven-plugin ×1