我使用xjc maven插件在WSDL中生成类型。按照我的配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>auth-service-type-generation</id>
<goals>
<goal>xjc</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<encoding>UTF8</encoding>
<schemaDirectory>${wsdl.location}</schemaDirectory>
<schemaFiles>${wsdl.auth.srv.file.name}</schemaFiles>
<xmlschema>false</xmlschema>
<wsdl>true</wsdl>
<nv>false</nv>
<bindingDirectory>${project.basedir}/src/main/resources/jaxb/</bindingDirectory>
<bindingFiles>jaxb_bindings.xjb</bindingFiles>
</configuration>
</execution>
</executions>
</plugin>
jaxb_bindings.xjb的内容:
<jaxb:bindings version="2.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxb:bindings>
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
</jaxb:bindings>
我使用此绑定来摆脱JAXBElement但它仍然生成。我的设置中有什么问题,或者在没有JAXBElement的情况下是否有另一种方法在我的WSDL中生成类型?
答案 0 :(得分:1)
您的配置中似乎缺少属性:schemaLocation
和node
。
<jaxb:bindings version="2.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxb:bindings schemaLocation="../path/your.xsd" node="/xs:schema">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
</jaxb:bindings>