使用jaxb

时间:2018-10-22 13:00:41

标签: java xsd jaxb

我正在尝试使用jaxb2 maven插件从xsd生成Java类,并且出现以下异常:

  

[错误]解析模式时出错。位置[xyz.xsd {9,84}]。org.xml.sax.SAXParseException:不支持的绑定命名空间“ http://annox.dev.java.net”。也许您的意思是“ http://jaxb2commons.dev.java.net/basic”? com.sun.tools.xjc.reader.AbstractExtensionBindingChecker.error(AbstractExtensionBindingChecker.java:213)

命名空间声明:

xmlns:annox="http://annox.dev.java.net"jaxb:extensionBindingPrefixes="annox"

插件:

<plugin>
   <groupId>org.jvnet.jaxb2.maven2</groupId>
   <artifactId>maven-jaxb2-plugin</artifactId>
   <configuration>
      <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>
      </plugins>
   </configuration>
   <dependencies>
      <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
          <version>2.9.3</version>
      </dependency>
   </dependencies>
</plugin>

0 个答案:

没有答案