升级到雅加达给我带来了一些问题。
我正在使用以下 Maven 插件:
<groupId>org.patrodyne.jvnet</groupId>
<artifactId>hisrc-higherjaxb40-maven-plugin</artifactId>
我使用情节编译(有库)。突然我面临以下问题:
Can't have @XmlAnyAttribute when a base class has it already.
this problem is related to the following location:
at @jakarta.xml.bind.annotation.XmlAnyAttribute()
仔细检查发现XJC突然生成了以下字段:
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<>();
它之前没有生成。我怎样才能禁用这个功能?
如评论中所述,根本原因在于JAXB-RI,请参阅#1735、#1356和#1146。
但是,hisrc-basicjaxb的下一个版本(无预计发布时间)将包含一个名为 fixOtherAttributes 的新 XJC 插件。该插件迭代 XJC 类轮廓并删除重复的
otherAttributes
字段及其关联的 @XmlAnyAttribute
、getter
和 setter
方法。
注意: 该插件需要将之前剧集中的 JAR 作为依赖项添加到 XJC 类路径中。特别是,在用于运行 XJC 的 Maven 插件中配置为依赖项。反射用于检测前一集 JAR 中的 original
字段。otherAttributes
免责声明:我是hisrc-basicjaxb项目的维护者。