Maven Jaxb2插件错误

时间:2012-02-09 15:29:24

标签: maven plugins jaxb maven-jaxb2-plugin

尝试使用NetBeans构建一个mavenized项目失败:

无法执行目标org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.5:生成(默认)项目MyProject:

目标org.jvnet.jaxb2.maven2的执行默认值:maven-jaxb2-plugin:0.7.5:生成失败:

执行org.jvnet.jaxb2.maven2时缺少必需的类:maven-jaxb2-plugin:0.7.5:generate:org / codehaus / plexus / util / DirectoryScanner

realm =    plugin>org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.5

strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

urls[0] = file:/C:/Users/user/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin/0.7.5/maven-jaxb2-plugin-0.7.5.jar

urls[1] = file:/C:/Users/user/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin-core/0.7.5/maven-jaxb2-plugin-core-0.7.5.jar

urls[2] = file:/C:/Users/user/.m2/repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar

urls[3] = file:/C:/Users/user/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar

urls[4] = file:/C:/Users/user/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar

urls[5] = file:/C:/Users/user/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar

urls[6] = file:/C:/Users/user/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar

urls[7] = file:/C:/Users/user/.m2/repository/org/jfrog/maven/annomojo/maven-plugin-anno/1.3.1/maven-plugin-anno-1.3.1.jar

urls[8] = file:/C:/Users/user/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb22-plugin/0.7.5/maven-jaxb22-plugin-0.7.5.jar

urls[9] = file:/C:/Users/user/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.2/jaxb-impl-2.2.2.jar

urls[10] = file:/C:/Users/user/.m2/repository/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar

urls[11] = file:/C:/Users/user/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar

urls[12] = file:/C:/Users/user/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar

urls[13] = file:/C:/Users/user/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.2/jaxb-xjc-2.2.2.jar

Number of foreign imports: 1

import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

我的POM.xml如下所示:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.7.5</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>

    <configuration>
        <schemaDirectory>src/main</schemaDirectory>
        <schemaIncludes>
            <include>package/aFile.xsd</include>
        </schemaIncludes>
        <generateDirectory>src/generated</generateDirectory>
        <generatePackage>package.jaxb2</generatePackage>
        <readOnly>true</readOnly>
    </configuration>
</plugin>

DirectoryScanner类是 plexus-utils 的一部分,我将其列为依赖项并安装在我的本地存储库中。

编辑:显然,如果我为jaxb2插件添加 plexus-utils 作为依赖,一切正常。

1 个答案:

答案 0 :(得分:2)

请尝试0.8.1版。以前的版本遭遇this problem,现在应该更正。