jaxb2-annotate-plugin
jaxb2-annotate-plugin copied to clipboard
How can I use the annotation plugin to enhance classes generated with jaxws-maven-plugin?
I am generating classes directly from a wsdl using wsimport. I would like to annotate the resulting classes. The jaxws-maven-plugin allows jaxb plugins to be included/compiled by including them as dependencies and passing the xjcArg that invokes them. Can I do the same with the jaxb2-annotate-plugin? How would I provide the binding file?
Yes, the plugin should work with jaxws-maven-plugin.
Please send me a PR or a sample project which compiles something with the jaxws-maven-plugin and I'll add some annotations via jaxb2-annotate-plugin. The test project should go under https://github.com/highsource/jaxb2-annotate-plugin/tree/master/tests.
I put what I've been working on up on github for cloning. I'm sorry I don't understand how it should be integrated under the project tests.
See this tutorial:
https://yangsu.github.io/pull-request-tutorial/
I can't just clone/copy your repo due to licensing issues.
Here's an example of using jaxb2-annotate-plugin with the jaxws-maven-plugin:
https://github.com/highsource/jaxb2-annotate-plugin/tree/master/tests/jaxws
I've managed to make it work with definitions from the schema imported in WSDL but not with the schema inside the WSDL. Customizations are ignored there.
However there's a question on StackOverflow which hints that this may be possible:
http://stackoverflow.com/questions/7154563/can-jaxb2-basics-be-configured-to-specify-an-interface-for-a-type-variable-of-a
Seems like inheritance:implements gets processed. Maybe it works with cxf-codegen-plugin?
Workaround for the moment is to move your schema definitions into individual schema files out of the WSDL.
This issue seems to have been fixed in the cxf-codegen-plugin:
https://issues.apache.org/jira/browse/CXF-2855
I'll move to cxf-codegen-plugin then.
The following link doesn't work anymore: https://github.com/highsource/jaxb2-annotate-plugin/tree/master/tests/jaxws
Could you please point out the correct link or details about how to integrate jaxb2 annotate plugin with jaxws maven plugin?
@ashokkhetan It does not work. I could not get jaxws-maven-plugin to run with XJC plugin under JDK 9+.
https://github.com/mojohaus/jaxws-maven-plugin/issues/54#issuecomment-397565960
I see. I am using:
<groupId>org.jvnet.jax-ws-commons</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.1</version>
Does this make a difference as it's not the mojohaus one? Does it mean that there is no possibility of annotating classes generated by jaxws-maven-plugin? I am creating classes for wsdl and corresponding schemas and need to change @XmlType (name) in some of the generated classes. Please suggest.
Please ask authors of your target jaxws-maven-plugin how to enable an XJC plugin with their tool. jaxb2-annotate-plugin is just an XJC plugin. I'm sorry I can't consult on all possible XJC plugin integrations.
sure, I will check. I just had a workaround in the meantime. I created the files using jaxws-maven-plugin - wsimport first, and then added another plugin entry to use jaxb2-annotate-plugin and overwrite some of the schema generated java files by applying bindings to xjc. Not so clean approach to do, I must admit.
Duplicate of https://github.com/highsource/jaxb-tools/issues/471 extensionBindingPrefixes is not taken into account in jaxws:bindings so annox is not read by plugin