我正在尝试使用 jaxb2 基础“简化”插件,但我总是收到以下异常......
[INFO] --- jaxws-maven-plugin:2.2:wsimport (default) @ dsmlv2-jaxws ---
[INFO] Processing: file:/C:/Users/fryera/Documents/GIT_DEV/cyberavenue/virgin-checkin-webapp-workspace/dsmlv2-web-services/dsmlv2-jaxws/src/main/resources/META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl
[INFO] jaxws:wsimport args: [-keep, -s, C:\Users\fryera\Documents\GIT_DEV\cyberavenue\virgin-checkin-webapp-workspace\dsmlv2-web-services\dsmlv2-jaxws\target\generated-sources\wsimport, -encoding, UTF-8, -extension, -Xnocompile, -httpproxy:@empproxy.8080, -wsdllocation, /META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl, -B-Xsimplify, -B-Xsetters, -B-Xequals, -B-XhashCode, -B-XtoString, -B-Xfluent-api, -b, C:\Users\fryera\Documents\GIT_DEV\cyberavenue\virgin-checkin-webapp-workspace\dsmlv2-web-services\dsmlv2-jaxws\src\main\resources\META-INF\wsdl\dsml\v2\jaxb-bindings.xml, -b, C:\Users\fryera\Documents\GIT_DEV\cyberavenue\virgin-checkin-webapp-workspace\dsmlv2-web-services\dsmlv2-jaxws\src\main\resources\META-INF\wsdl\dsml\v2\jaxws-bindings.xml, file:/C:/Users/fryera/Documents/GIT_DEV/cyberavenue/virgin-checkin-webapp-workspace/dsmlv2-web-services/dsmlv2-jaxws/src/main/resources/META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl]
parsing WSDL...
[ERROR] cvc-elt.1: Cannot find the declaration of element 'simplify:property'.
line 17 of file:/C:/Users/fryera/Documents/GIT_DEV/cyberavenue/virgin-checkin-webapp-workspace/dsmlv2-web-services/dsmlv2-jaxws/src/main/resources/META-INF/wsdl/dsml/v2/jaxb-bindings.xml
我有一个看起来像这样的 jaxb bindings.xml 文件......
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify" jaxb:extensionBindingPrefixes="xjc simplify" jaxb:version="2.1">
<jaxb:bindings>
<jaxb:globalBindings typesafeEnumMaxMembers="2000">
<xjc:simple />
<xjc:serializable uid="456" />
</jaxb:globalBindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="urn:oasis:names:tc:DSML:2:0:core">
<jaxb:schemaBindings>
<jaxb:package name="oasis.dsml.v2_0.model" />
</jaxb:schemaBindings>
<jaxb:bindings scd="~tns:BatchRequest">
<simplify:property name="fooOrBar">
<simplify:as-element-property />
</simplify:property>
</jaxb:bindings>
</jaxb:bindings>
</bindings>
在我的 pom 中,我正在尝试使用 cxf-codegen-plugin 和 jaxws-maven-plugin 编译我的 WSDL。我使用哪一个并不重要,我在 jaxb 绑定文件中使用时遇到相同的异常。插件配置如下...
<!-- WSIMPORT USING JAXWS-MAVEN-PLUGIN -->
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${jaxb2-basics.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-fluent-api</artifactId>
<version>${jaxb2-fluent-api.version}</version>
</dependency>
</dependencies>
<configuration>
<extension>true</extension>
<bindingDirectory>src/main/resources/META-INF/wsdl/dsml/v2</bindingDirectory>
<wsdlDirectory>src/main/resources/META-INF/wsdl/dsml/v2</wsdlDirectory>
<wsdlLocation>/META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl</wsdlLocation>
<xjcArgs>
<xjcArg>-Xsimplify</xjcArg>
<xjcArg>-Xsetters</xjcArg>
<xjcArg>-Xequals</xjcArg>
<xjcArg>-XhashCode</xjcArg>
<xjcArg>-XtoString</xjcArg>
<xjcArg>-Xfluent-api</xjcArg>
</xjcArgs>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>dsmlQueryService.wsdl</wsdlFile>
</wsdlFiles>
</configuration>
</execution>
</executions>
</plugin>