问题
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?
回答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>
回答2:
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.
来源:https://stackoverflow.com/questions/10021013/is-there-a-way-to-strip-annotations-when-using-the-cxf-codegen-plugin-for-genera