I'm writing a complex program that splits its work into multiple projects. Each
project produces a jar, some of which depend on classes supplied by other jars.
Let's call these projects A, B and C, where A and B use classes defined in C.
Now C defines a schema core.xsd. B defines a schema beta.xsd which imports
core.xsd. And A defines alpha.xsd which also imports core.xsd. Each of these
schemas have different namespaces.
I'd like to generate JAXB code for each of these projects, but am running into
the problem that all three projects generate their own copy of the classes
described by core.xsd. I can't generate all the JAXB in only one project, since
all projects need access to the produced code. I also can't create a special
project that contains only JAXB code since I may not have access to all projects
at compile time (I'm designing a plugin architecture, so A will not necessarily
even exist at the time the core classes are compiled and distributed).
Ideally I would be able to generate core.xsd classes and compile them into
C.jar. When JAXB classes are generated for B.jar and A.jar, they would realize
that these classes already exist in another project and not create duplicates.
This could be done by adding a binding that lets me suppress generation of
classes for specified namespaces. I could set this binding when running xjc on
my A and B projects.
You could also likely implement this by allowing the user to specify per
namespace which directory (not just package name) binding code is generated to.
Then the compiler could check to see if the generated code already exists.