java - Maven CXF 插件 API 不兼容

标签 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 构建作业后,此错误消失了。

如有任何提示,我们将不胜感激。

西蒙

最佳答案

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

旧的 2.3.3 版本是旧开发团队的遗产(看起来与新的 Maven 版本的组合是问题所在)。

关于java - Maven CXF 插件 API 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27981539/

相关文章:

java - 门户 Controller 的 setContentType 失败

java - 起始序列的正则表达式

android - 获取根元素必须格式正确。 Android版本中的错误

java - maven cxf-codegen-plugin XMLStreamException 错误 : Attribute limit

java - 无签名 token Java CXF 客户端

java - System.arraycopy 性能

java - 由 : java. lang.RuntimeException : Cannot run Liquibase, liquibase.datasource 未设置引起

spring - java.lang.NoClassDefFoundError : org/hibernate/engine/SessionFactoryImplementor from Spring 3. 1.2/Hibernate 4.1.7 和 Shards 3.0.0.Beta2

java - 发送请求时 WSDL 字段名称不同

java - 从 jsoup 解析中省略链接、广告等