Camel 如何修复cxf-codegen-plugin在POM中抛出的错误

svmlkihl  于 2022-11-23  发布在  Apache
关注(0)|答案(2)|浏览(125)

我想在我的camel maven项目中使用cxf-codegen-plugin来生成带有wsdl 2 java的源代码。
我添加了如下插件到我的pom.

<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这将有助于。

2g32fytz

2g32fytz1#

我不断地根据错误堆栈中的细节进行修改,这些细节随着每次修改而不断变化。

<plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>3.2.4</version>
                <dependencies>
                    <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.3.1</version>
                    </dependency>
                    <!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
                    <dependency>
                        <groupId>javax.xml.ws</groupId>
                        <artifactId>jaxws-api</artifactId>
                        <version>2.1</version>
                    </dependency>
                    <!-- https://mvnrepository.com/artifact/javax.jws/javax.jws-api -->
                    <dependency>
                        <groupId>javax.jws</groupId>
                        <artifactId>javax.jws-api</artifactId>
                        <version>1.1</version>
                    </dependency>
                </dependencies>
                <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>
c8ib6hqw

c8ib6hqw2#

我把我的jdk版本从11改成了8,它对我很有效

相关问题