jaxb annox plugin not working

Dean Hiller picture Dean Hiller · May 12, 2012 · Viewed 8.9k times · Source

I am getting the following error on the annox plugin for jaxb generation

[ERROR] file:/Users/dhiller/Space/ifp-core/framework/src/main/resources/schemas/common_2012_04.xsd[5,136]
org.xml.sax.SAXParseException: Unsupported binding namespace "http://annox.dev.java.net". Perhaps you meant "http://java.sun.com/xml/ns/jaxb/xjc"?

Here is the code I have. The versions must be screwed up somehow? Anyone have some working example with all the version numbers

            <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb21-plugin</artifactId>
            <version>0.8.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <args>
                    <arg>-XtoString</arg>
                    <arg>-Xequals</arg>
                    <arg>-XhashCode</arg>
                    <arg>-Xcopyable</arg>
                </args>
                <plugins>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>0.6.3</version>
                    </plugin>
                </plugins>
            </configuration>
        </plugin>       
        <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>jaxb2-maven-plugin</artifactId>
           <version>1.3.1</version>
           <executions>
              <execution>
                 <goals>
                    <goal>xjc</goal>
                 </goals>
              </execution>
           </executions>
           <configuration>
              <clearOutputDir>false</clearOutputDir>
              <schemaDirectory>${basedir}/src/main/resources/schemas</schemaDirectory>
              <schemaFiles>externalaction_2012_03.xsd,common_2012_04.xsd,utilities_2012_03.xsd</schemaFiles>
              <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
              <bindingDirectory>${basedir}/src/main/xjb</bindingDirectory>
              <bindingFiles>bindings.xjb.xml</bindingFiles>
              <extension>true</extension>
           </configuration>
        </plugin>

Answer

kavai77 picture kavai77 · Dec 3, 2013

I think you are missing some dependencies from <plugin>. Try this code:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>1.5</version>
    <executions>
        <execution>
            <id>xjc</id>
            <goals>
                <goal>xjc</goal>
            </goals>
            <configuration>
                <extension>true</extension>
                <arguments>-Xannotate</arguments>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-annotate</artifactId>
            <version>0.6.4</version>
        </dependency>
        <dependency>
            <groupId>com.sun.codemodel</groupId>
            <artifactId>codemodel</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>
</plugin>