So, usually I apply JAXB annotations in the code as follows:
package com.example;
@XmlRootElement(name = \"Foo\", namespace = \"example.com\")
@XmlType(name = \
If you just need to add @XmlType(name = "Foo", namespace = "example.com")
annotation to the generated class you can use JAXB Annotate Plugin.
Here is documentation about how to define annotations in external binding files.
If you're using CXF and maven you can also you cxf-codegen-plugin somehow like this
org.apache.cxf
cxf-codegen-plugin
${cxf.version}
generate-sources
generate-sources
wsdl2java
${service.src.dir}
service.wsdl
-xjc-Xannotate
-b
${wsdl.dir}/bindings.xjb
org.jvnet.jaxb2_commons
jaxb2-basics-annotate
${jaxb.commons.version}
You can also use maven-jaxb2-plugin:
org.jvnet.jaxb2.maven2
maven-jaxb2-plugin
${maven-jaxb2.version}
process-xsd
generate
generate-sources
**/*.xsd
**/*.xjb
${jaxb.src.dir}
true
-Xannotate
org.jvnet.jaxb2_commons
jaxb2-basics-annotate
${jaxb.commons.version}
Here is sample binding file:
If you need to modify @XmlRootElement
too, just add another one annox:annotate
element: