0

以下插件调用不断失败:

            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <executions>
                    <execution>
                        <id>generate-resources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/emailIRN.wsdl</wsdl>
                                    <extraargs>
                                        <extraarg>-fe</extraarg>
                                        <extraarg>jaxws21</extraarg>
                                        <extraarg>-verbose</extraarg>
                                    </extraargs>
                                </wsdlOption>
... more wsdlOption blocks...

有两个警告:

 [WARNING] Error: Could not find or load main class org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java
 [WARNING] Caused by: java.lang.ClassNotFoundException: org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java

然后整个事情失败了:

/usr/lib/jvm/java-10-openjdk-amd64/bin/java --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -jar /tmp/cxf-tmp-975998357168064227/cxf-codegen15218503234725715130.jar /tmp/cxf-tmp-975998357168064227/cxf-w2j6542191939703642136args
4

1 回答 1

0

经过多次试验和错误,我意识到 OpenJDK 10 的问题是没有定义 JEE API。这会导致插件静默失败(无论给出什么调试选项)。

我还将插件更改为旧版本,因为新版本似乎对 JEE 7 API 不满意。

                <version>3.2.0</version>

我能够通过添加javaee-api如下依赖项来解决这个问题:

            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>3.2.0</version>
                <dependencies>
                    <dependency>
                        <groupId>javax</groupId>
                        <artifactId>javaee-api</artifactId>
                        <version>7.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>generate-resources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/emailIRN.wsdl</wsdl>
                                    <extraargs>
                                        <extraarg>-fe</extraarg>
                                        <extraarg>jaxws21</extraarg>
                                        <extraarg>-verbose</extraarg>
                                    </extraargs>
                                </wsdlOption>
    ... more wsldOption blocks ...
于 2020-07-11T00:20:03.220 回答