JAXB自定义绑定接口

时间:2012-03-28 18:01:38

标签: java binding interface jaxb xjc

我正试图让它运行:JAXB interface

但我总是得到错误:不支持的绑定命名空间“http://jaxb2-commons.dev.java.net/basic/inheritance”。也许你的意思是“http://jaxb.dev.java.net/plugin/code-injector”?

是否有一些新方法让生成的bean实现接口?

编辑:我的POM中的cxf版本2.4.0也收到警告unrecognized parameter -Xinheritance

 <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-xjc-plugin</artifactId>
            <version>2.4.0</version>
            <configuration>
                <extensions>
                    <extension>org.apache.cxf.xjcplugins:cxf-xjc-boolean:2.4.0</extension>
                <extension>org.apache.cxf.xjcplugins:cxf-xjc-bug671:2.4.0</extension>
                    <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.4.0</extension>
                    <extension>org.apache.cxf.xjcplugins:cxf-xjc-ts:2.4.0</extension>
                      <extension>org.apache.cxf.xjcplugins:cxf-xjc-pl:2.4.0</extension>
                       <extension>org.apache.cxf.xjcplugins:cxf-xjc-ts:2.4.0</extension>
                    <extension>org.apache.cxf.xjcplugins:cxf-xjc-wsdlextension:2.4.0</extension>
                </extensions>
            </configuration>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>xsdtojava</goal>
                    </goals>
                    <configuration>
                        <xsdOptions>
                            <xsdOption>
                                <extension>true</extension>
                                <xsd>some.xsd</xsd>
                                <packagename>somepackage</packagename>
                         <bindingFile>src\main\resources\bindings\bindings.xml</bindingFile>  
                            <extensionArgs>
                            <arg>-Xdv</arg>
                            <arg>-Xinheritance</arg>
                        </extensionArgs>                             
                            </xsdOption>
                        </xsdOptions>
                    </configuration>
                </execution>
                 <execution>
                  <configuration>
            </configuration>
                 </execution>
            </executions>
   <dependencies>
<dependency>
    <groupId>org.jvnet.jaxb2_commons</groupId>
    <artifactId>jaxb2-basics-runtime</artifactId>
    <version>0.6.3</version>
</dependency>

            

1 个答案:

答案 0 :(得分:2)

您需要添加jaxb2-basics插件作为CXF插件的依赖项。请参见示例6 http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html

例如在最后添加

  <dependencies>
    <dependency>
        <groupId>org.jvnet.jaxb2_commons</groupId>
        <artifactId>jaxb2-basics-runtime</artifactId>
        <version><!-- Current version --></version>
    </dependency>
   </dependencies>
</plugin>