I'm using the Maven jaxb2 plugin to generate a default value constructor for my generated JAXB classes. The problem that I'm having is that the ordering of the attributes/fields changes on different calls to generate-sources
, and this changes the generated constructor as a result.
The attributes are defined in the schema as a collection of three attribute groups:
<xsd:attributeGroup name="CollectionAttributeGroup">
<xsd:attributeGroup ref="AttributeGroupA"/>
<xsd:attributeGroup ref="AttributeGroupB"/>
<xsd:attributeGroup ref="AttributeGroupC"/>
</xsd:attributeGroup>
The attributes within each of the sub-groups (e.g. AttributeGroupA) will always be in the same order, but the order of the sub-groups seems to change with each call. This makes my constructors unusable, as there's no guarantee of the order of the fields, and each new build can break existing code.
Any ideas on how to enforce the ordering of attributes/fields?