Maven CXF插件API不兼容

时间:2015-01-16 10:06:50

标签: java maven cxf-codegen-plugin

我正在使用Maven 3.2.3来构建我的项目,并且我不断收到这个奇怪的错误:

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.3.3:wsdl2java (generate-sources) on project ecmcodes-ws-client: Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:2.3.3:wsdl2java failed: An API incompatibility was encountered while executing org.apache.cxf:cxf-codegen-plugin:2.3.3:wsdl2java: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.cxf:cxf-codegen-plugin:2.3.3
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-codegen-plugin/2.3.3/cxf-codegen-plugin-2.3.3.jar
[ERROR] urls[1] = file:/c:/Users/test/.m2/repository/org/apache/maven/shared/maven-artifact-resolver/1.0/maven-artifact-resolver-1.0.jar
[ERROR] urls[2] = file:/c:/Users/test/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] urls[3] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-tools-common/2.3.3/cxf-tools-common-2.3.3.jar
[ERROR] urls[4] = file:/c:/Users/test/.m2/repository/org/apache/velocity/velocity/1.6.4/velocity-1.6.4.jar
[ERROR] urls[5] = file:/c:/Users/test/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
[ERROR] urls[6] = file:/c:/Users/test/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar
[ERROR] urls[7] = file:/c:/Users/test/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
[ERROR] urls[8] = file:/c:/Users/test/.m2/repository/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar
[ERROR] urls[9] = file:/c:/Users/test/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.1.13/jaxb-xjc-2.1.13.jar
[ERROR] urls[10] = file:/c:/Users/test/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.13/jaxb-impl-2.1.13.jar
[ERROR] urls[11] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-api/2.3.3/cxf-api-2.3.3.jar
[ERROR] urls[12] = file:/c:/Users/test/.m2/repository/org/apache/neethi/neethi/2.0.4/neethi-2.0.4.jar
[ERROR] urls[13] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-rt-core/2.3.3/cxf-rt-core-2.3.3.jar
[ERROR] urls[14] = file:/c:/Users/test/.m2/repository/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar
[ERROR] urls[15] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-tools-wsdlto-core/2.3.3/cxf-tools-wsdlto-core-2.3.3.jar
[ERROR] urls[16] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-tools-validator/2.3.3/cxf-tools-validator-2.3.3.jar
[ERROR] urls[17] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-common-schemas/2.3.3/cxf-common-schemas-2.3.3.jar
[ERROR] urls[18] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-common-utilities/2.3.3/cxf-common-utilities-2.3.3.jar
[ERROR] urls[19] = file:/c:/Users/test/.m2/repository/org/apache/ws/commons/schema/XmlSchema/1.4.7/XmlSchema-1.4.7.jar
[ERROR] urls[20] = file:/c:/Users/test/.m2/repository/org/codehaus/woodstox/woodstox-core-asl/4.0.8/woodstox-core-asl-4.0.8.jar
[ERROR] urls[21] = file:/c:/Users/test/.m2/repository/org/codehaus/woodstox/stax2-api/3.0.2/stax2-api-3.0.2.jar
[ERROR] urls[22] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-tools-wsdlto-databinding-jaxb/2.3.3/cxf-tools-wsdlto-databinding-jaxb-2.3.3.jar
[ERROR] urls[23] = file:/c:/Users/test/.m2/repository/org/apache/cxf/cxf-tools-wsdlto-frontend-jaxws/2.3.3/cxf-tools-wsdlto-frontend-jaxws-2.3.3.jar
[ERROR] urls[24] = file:/c:/Users/test/.m2/repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar
[ERROR] urls[25] = file:/c:/Users/test/.m2/repository/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.jar
[ERROR] urls[26] = file:/c:/Users/test/.m2/repository/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.jar
[ERROR] urls[27] = file:/c:/Users/test/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
[ERROR] urls[28] = file:/c:/Users/test/.m2/repository/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.jar
[ERROR] urls[29] = file:/c:/Users/test/.m2/repository/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3.0.5.RELEASE.jar
[ERROR] urls[30] = file:/c:/Users/test/.m2/repository/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.jar
[ERROR] urls[31] = file:/c:/Users/test/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[32] = file:/c:/Users/test/.m2/repository/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.jar
[ERROR] urls[33] = file:/c:/Users/test/.m2/repository/org/apache/ant/ant/1.8.1/ant-1.8.1.jar
[ERROR] urls[34] = file:/c:/Users/test/.m2/repository/org/apache/ant/ant-launcher/1.8.1/ant-launcher-1.8.1.jar
[ERROR] urls[35] = file:/c:/Users/test/.m2/repository/org/apache/ant/ant-nodeps/1.8.1/ant-nodeps-1.8.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.apache.cxf.Messages != org.apache.cxf.APIMessages
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

这是否意味着我将错误版本的Java与cxf插件(2.3.3)结合使用?

mvn -version的输出:

Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00)
Maven home: C:\Program Files\apache-maven-3.2.3
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_71\jre
Default locale: cs_CZ, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

另一个奇怪的事情是,在重新运行mvn构建作业后,此错误消失了。

任何提示都表示赞赏。

希蒙

1 个答案:

答案 0 :(得分:0)

在我的项目中将CXF依赖项的版本更新为评论中建议的 khmarbaise 的较新版本(2.7.14)后,错误消失了。

旧的2.3.3版本是旧开发团队的遗产(似乎与新版Maven版本的组合是问题)。