问题
I know how to enable extensions in a plain JAXB bindings file - list them in the root element's extensionBindingPrefixes
:
<jaxb:bindings
version="1.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc"
...>
However, a JAX-WS bindings file doesn't have anywhere to put this attribute.
<jaxws:bindings
version="2.0"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
wsdlLocation="../wsdl/schema.wsdl"
...>
It cannot go in the root, nor in any of the nested jaxb:bindings
elements.
How are you supposed to enable binding extensions?
Example command-line arguments used by jaxws-maven-plugin:2.4.1:
-keep
-s 'target/generated-sources/wsimport'
-d 'target/classes'
-encoding UTF-8
-extension
-Xnocompile
-B-XJsr303Annotations
-B-Xvalue-constructor
-B-Xinheritance
-b 'src/jaxws/bindings.xml'
'src/wsdl/schema.wsdl'
来源:https://stackoverflow.com/questions/39640430/using-jaxb-binding-extensions-in-wsimport