2

我有 jaxb2-maven-plugin 版本 1.5 和 axistools-maven-plugin 版本 1.4 当我执行 maven 生成源时,我收到一个错误.. 任何帮助都会非常有用。

[INFO] 
[INFO] --- jaxb2-maven-plugin:1.5:xjc (default) @ TouchStoneCore ---
[INFO] Generating source...
[INFO] parsing a schema...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.456s
[INFO] Finished at: Wed Jun 26 15:40:58 PDT 2013
[INFO] Final Memory: 28M/351M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc (default) on project TouchStoneCore: Execution default of goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc failed: An API incompatibility was encountered while executing org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc: java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:jaxb2-maven-plugin:1.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/M2/repository/org/codehaus/mojo/jaxb2-maven-plugin/1.5/jaxb2-maven-plugin-1.5.jar
[ERROR] urls[1] = file:/C:/M2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar
[ERROR] urls[2] = file:/C:/M2/repository/com/sun/xml/bind/jaxb-xjc/2.1.13/jaxb-xjc-2.1.13.jar
[ERROR] urls[3] = file:/C:/M2/repository/com/sun/xml/bind/jaxb-impl/2.1.13/jaxb-impl-2.1.13.jar
[ERROR] urls[4] = file:/C:/M2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar
[ERROR] urls[5] = file:/C:/M2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar
[ERROR] urls[6] = file:/C:/M2/repository/javax/activation/activation/1.1/activation-1.1.jar
[ERROR] urls[7] = file:/C:/M2/repository/org/codehaus/plexus/plexus-compiler-api/1.9.1/plexus-compiler-api-1.9.1.jar
[ERROR] urls[8] = file:/C:/M2/repository/org/codehaus/plexus/plexus-utils/3.0.4/plexus-utils-3.0.4.jar
[ERROR] urls[9] = file:/C:/M2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
4

3 回答 3

0

试试下面的代码片段

<groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.6</version>

对于 java 8,您可以尝试使用更高版本

于 2017-08-28T18:20:38.100 回答
0

这是版本控制的问题。尝试使用不同版本的 jaxb2-maven-plugin 直到通过。

于 2020-04-07T21:04:40.567 回答
0

我使用 Linux 并通过以下方式解决此问题 -

导出 JAVA_HOME=/usr/lib/jvm/{java 版本}

示例 - 导出 JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64

于 2021-02-02T16:00:51.787 回答