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

♀尐吖头ヾ 提交于 2020-01-14 06:12:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!