我想在我的骆驼 maven 项目中使用 cxf-codegen-plugin 生成带有 wsdl2java 的源。
我将插件如下添加到我的 pom.xml 中。
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/BookService.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
这会在 pom 中引发错误...
Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:3.2.4:wsdl2java failed: A required class was missing while executing org.apache.cxf:cxf-codegen-
plugin:3.2.4:wsdl2java: javax/xml/bind/annotation/adapters/HexBinaryAdapter ----------------------------------------------------- realm = plugin>org.apache.cxf:cxf-codegen-
plugin:3.2.4 strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy urls[0] = file:/C:/esb/.m2/repository/org/apache/cxf/cxf-codegen-plugin/3.2.4/cxf-codegen-
plugin-3.2.4.jar urls[1] = file:/C:/esb/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar urls[2] = file:/C:/esb/.m2/repository/org/codehaus/plexus/plexus-
archiver/1.2/plexus-archiver-1.2.jar ...
我尝试了其他示例项目,例如https://github.com/sigreen/camel-cxf-soap-client并在 pom 中遇到了类似的错误因为我确信它在 2015 年提交该项目时可以恢复,我认为它是今天版本不匹配。
如果有人最近有一个带有 cxf-codegen-plugin 的项目,那会有所帮助。