jaxb annox插件无法正常工作

时间:2012-05-12 16:14:32

标签: jaxb annox

我在jaxb生成的annox插件上遇到以下错误

[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"?

这是我的代码。版本必须以某种方式搞砸?任何人都有一些包含所有版本号的工作示例

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

2 个答案:

答案 0 :(得分:4)

我认为你遗漏了<plugin>的一些依赖关系。试试这段代码:

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

答案 1 :(得分:0)

为什么这个帖子是评论。试着发布我在这里发布的答案

JAXB External Custom Binding XJC Issue - Parsing results in empty node