I'm looking for a way to reuse bindings in order to avoid re-generation of classes each time I use types from XSDs of other projects.
I'm using maven and the maven-jaxb2-plugin.
Let say I have two projects A and B.
Project A defines a.xsd and is configured with the maven-jaxb2-plugin to generate the classes A1, A2, ... from a.xsd
Project B depends on project A and defines b.xsd, which uses some types defined in a.xsd. B in configured with the maven-jaxb2-plugin to generate the classes B1, B2, ... from a.xsd
To avoid the generation of the classes A1, A2, ... when building B, I included a section like the following in the binding configuration used in project B.
<jaxb:bindings scd="x-schema::tns" xmlns:tns="http://somedomain/A">
<jaxb:schemaBindings map="false"/>
<jaxb:bindings scd="~tns:A1">
<jaxb:class ref="com.example.A1"/>
</jaxb:bindings>
<jaxb:bindings scd="~tns:A2">
<jaxb:class ref="com.example.A2"/>
</jaxb:bindings>
</jaxb:bindings>
This work fine.
Now suppose I have project C also depending on project A and defining c.xsd which uses types from a.xsd.
To avoid regeneration, I could include the above configuration in the binding configuration of project C, but this will lead me to configure the same binding block multiple times.
Is it possible to configure the common bindings somewhere and include it in the binding configuration of B and C in order to avoid redundancy?