Is there a way to strip annotations when using the cxf-codegen-plugin for generating sources?

Go To StackoverFlow.com

0

I'm using the cxf-codegen-plugin to generate some classes from a WSDL. After the sources are generated, a bunch of beans get deleted (we don't need them, just the service interfaces), but there is an @XmlSeeAlso annotation in the generated source that references some of these deleted classes. We don't need the @XmlSeeAlso annotation at all, is there a way to tell the cxf-codegen-plugin to exclude certain annotations when generating sources?

2012-04-05 00:08
by John Leehey


1

I solved this by adding a tag to a maven-antrun-plugin, commenting out all the @XmlSeeAlso instances:

<target>
    <replace file="${basedir}/target/generated-sources/x/x/x/Service.java" token="@XmlSeeAlso" value="//@XmlSeeAlso" />
</target>
2012-04-05 22:23
by John Leehey


0

The idea of generated code is to let it be as it is. The question is why would you like to delete files which i assume is manual work which is in contradiction to the idea of generated code.

2012-04-05 07:24
by khmarbaise
An ant task deletes the files for me. The files need to be deleted because they are duplicate beans created from an axis2 implementation. I can't do anything about the schemas I'm given - John Leehey 2012-04-05 18:17
Hm. What i don't understand that you described the classes are not used. But here you write they are duplicates. Does that mean you get error messages during the generation process? Furthermore it's sound a little bit strange to me that you say the service interfaces uses those classes but you don't ? - khmarbaise 2012-04-05 18:27
The bean classes that are created by the cxf-codegen-plugin are not used because they have already been generated as axis2 beans (I am adding a CXF interface to an axis2 project). The service interface specifically tries to reference (not use) the ObjectFactory classes that are generated by the cxf-codegen-plugin. There are no errors when generating - John Leehey 2012-04-05 18:40
Ads