Maven Jaxb插件错误 - 缺少必需的类

时间:2015-02-12 04:37:21

标签: java maven jaxb pom.xml

我正在使用maven 3.1.0。

尝试通过cmd构建时出错。

[ERROR] Failed to execute goal org.jvnet.jaxb1.maven2:maven-jaxb1-plugin:1.0-rc9:generate (default) on project Myproject: Execution default of goal org.jvnet.jaxb1.maven2:maven-jaxb1-plugin:1.0-rc9:generate failed: A required class was missing while executing org.jvnet.jaxb1.maven2:maven-jaxb1-plugin:1.0-rc9:generate: com/sun/msv/grammar/Grammar
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.jvnet.jaxb1.maven2:maven-jaxb1-plugin:1.0-rc9
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/.m2/repository/org/jvnet/jaxb1/maven2/maven-jaxb1-plugin/1.0-rc9/maven-jaxb1-plugin-1.0-rc9.jar
[ERROR] urls[1] = file:/C:/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] urls[2] = file:/C:/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[3] = file:/C:/.m2/repository/com/sun/xml/bind/jaxb-xjc/1.0.6/jaxb-xjc-1.0.6.jar
[ERROR] urls[4] = file:/C:/.m2/repository/com/sun/xml/bind/jaxb-impl/1.0.6/jaxb-impl-1.0.6.jar
[ERROR] urls[5] = file:/C:/.m2/repository/javax/xml/bind/jaxb-api/1.0/jaxb-api-1.0.jar
[ERROR] urls[6] = file:/C:/.m2/repository/javax/xml/parsers/jaxp-api/1.4/jaxp-api-1.4.jar
[ERROR] urls[7] = file:/C:/.m2/repository/com/sun/xml/parsers/jaxp-ri/1.4/jaxp-ri-1.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: com.sun.msv.grammar.Grammar

我通过命令行调用了maven。

我的POM.xml如下所示:

<plugin>
    <groupId>org.jvnet.jaxb1.maven2</groupId>
    <artifactId>maven-jaxb1-plugin</artifactId>
    <version>1.0-rc9</version>
    <executions>
        <execution>
            <goals>
               <goal> generate  </goal>
            </goals>
     </execution>
    </executions>
<configuration>
<generatePackage>jaxb1/package</generatePackage>
</configuration>

1 个答案:

答案 0 :(得分:0)

免责声明:我是这个插件的作者,很久以前写过。

正如@skaffman所说,JAXB 1很古老,所以maven-jaxb1-plugin目前尚未得到积极支持。请改用maven-jaxb2-plugin

如果您有特殊原因被迫使用maven-jaxb1-plugin,您可能需要自行修复。我可以将代码移动到GitHub并接受拉取请求。这是我现在能做的最好的事情。