我正在尝试使用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>
答案 0 :(得分:1)
你正在点击JAXB-1047 - SCD bindings do not support custom/vendor customization elements。
没有解决方法,而是使用XPath绑定。
免责声明:我是jaxb2-basics的作者。
答案 1 :(得分:0)
通常您需要plugins
下的configuration
节点才能让xjc
能够加载插件。
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${jaxb2-basics.version}</version>
</plugin>
</plugins>