Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use the annotation plugin to enhance classes generated with jaxws-maven-plugin? #17

Open
end-user opened this issue Nov 15, 2015 · 12 comments
Labels

Comments

@end-user
Copy link

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?

@highsource
Copy link
Owner

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.

@end-user
Copy link
Author

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.

@highsource
Copy link
Owner

See this tutorial:

https://yangsu.github.io/pull-request-tutorial/

@highsource
Copy link
Owner

I can't just clone/copy your repo due to licensing issues.

highsource added a commit that referenced this issue Nov 15, 2015
@highsource
Copy link
Owner

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.

@highsource highsource added this to the 1.0.3 milestone Nov 15, 2015
@highsource
Copy link
Owner

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.

@highsource highsource removed this from the 1.0.3 milestone May 24, 2018
@ashokkhetan
Copy link

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?

@highsource
Copy link
Owner

@ashokkhetan It does not work. I could not get jaxws-maven-plugin to run with XJC plugin under JDK 9+.

mojohaus/jaxws-maven-plugin#54 (comment)

@ashokkhetan
Copy link

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.

@highsource
Copy link
Owner

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.

@ashokkhetan
Copy link

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.

@laurentschoelens
Copy link
Collaborator

Duplicate of highsource/jaxb-tools#471
extensionBindingPrefixes is not taken into account in jaxws:bindings so annox is not read by plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants