Upgrading to jakarta caused some issues for me.
I'm using the following maven plugin:
<groupId>org.patrodyne.jvnet</groupId>
<artifactId>hisrc-higherjaxb40-maven-plugin</artifactId>
And I use episodal compilation (have libraries). Suddenly I'm facing the following problem:
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()
Closer inspection reveals that XJC suddenly generates the following field:
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<>();
which it did not generate before. How can I disable this?
As stated in the comments, the root cause is in JAXB-RI, see #1735, #1356 and #1146.
However, the next release (no ETA) of hisrc-basicjaxb will include a new XJC plugin named fixOtherAttributes. This plugin iterates over the XJC class outlines and removes duplicate otherAttributes
field(s) together with their associated @XmlAnyAttribute
, getter
and setter
methods.
Note: This plugin requires JAR(s) from previous episodes be added, as dependencies, to the XJC classpath. In particular, configured as dependencies in the Maven plugin used to run XJC. Reflection is used to detect the original
otherAttributes
field from the previous episode's JAR(s). For a sample configuration, see hisrc-basicjaxb:higher/tests/episodes/b/pom.xml.
Disclaimer: I am the maintainer for the hisrc-basicjaxb project.