I have an XSD file that import all my other XSD.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="z-common.xsd"/>
<xs:include schemaLocation="a-first.xsd"/>
<xs:include schemaLocation="b-second.xsd"/>
<xs:include schemaLocation="c-third.xsd"/>
</xs:schema>
common.xsd file define multiple complex Type
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="MyType">
<xs:all>
<xs:element minOccurs="1" type="xs:string" name="attr1"/>
<xs:element minOccurs="1" type="xs:string" name="attr2"/>
</xs:all>
</xs:complexType>
</xs:schema>
All other XSD use this complex type. Example :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="MyObject">
<xs:all>
<xs:element minOccurs="0" type="MyType" name="myType"/>
</xs:all>
</xs:complexType>
</xs:schema>
But when I build my project with jaxb2-maven-plugin, it's fail because MyType is not found. In fact, this plugin seems to don't respect import order and take them alphabetically.
I have found multiple solution with bindings for example, but these solutions must modify XSD content (and I can't because it's not mind)
How can we do that ?