我有一个Vendor.xsd,其中命名空间定义引用了供应商特定的命名空间http://vendor.com/xjc-plugins。下面给出了一个片段:
...
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:common="http://annox.dev.java.net"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:vendor="http://vendor.com/xjc-plugins"
elementFormDefault="qualified"
jaxb:extensionBindingPrefixes="vendor common"
jaxb:version="2.0">
...
xs:complexType name="VendorType">
<xs:annotation>
<xs:appinfo>
<vendor:package>vendor.package</vendor:package>
</xs:appinfo>
</xs:annotation>
...
当我尝试使用命令行中的xjc或maven-jaxb22-plugin生成jaxbs时,会发生以下异常:
Unsupported binding namespace "http://vendor.com/xjc-plugins". Perhaps you meant "http://annox.dev.java.net"?
我正在使用的maven插件在这里给出:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb22-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources</schemaDirectory>
<schemaIncludes>
<include>Vendor.xsd</include>
</schemaIncludes>
<generatePackage>com.vendor.model</generatePackage>
<extension>true</extension>
<args>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>1.0.2</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>1.11.1</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-tools</artifactId>
<version>1.11.1</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
欢迎任何想法?
答案 0 :(得分:1)
您似乎没有在plugins
配置的maven-jaxb2-plugin
部分中包含您的XJC插件。绑定命名空间必须由某个插件确认。您只包含jaxb2-basics
,但不包含承认http://vendor.com/xjc-plugins
的插件。