Maven Jaxb2 plugin errors

jaxbmavenmaven-jaxb2-pluginplugins

Trying to build a mavenized project with NetBeans fails:

Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.5:generate (default) on project MyProject:

Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.5:generate failed:

A required class was missing while executing 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]]

My POM.xml looks like this:

<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>

The DirectoryScanner class is a part of plexus-utils, which I have listed as a dependency and is installed in my local repository.

EDIT: apparently, everything works if I add a plexus-utils as a dependency for the jaxb2 plugin.

Best Answer

Please try version 0.8.1. Previous versions suffered from this problem, now it should be corrected.

Related Topic