How do I prevent JAXB from generating Java from imported schema?
Posted
by Mark
on Stack Overflow
See other posts from Stack Overflow
or by Mark
Published on 2010-04-06T21:34:37Z
Indexed on
2010/04/06
21:43 UTC
Read the original article
Hit count: 223
I've got two Java projects, both generate Java classes based on a schema definition, I'm using xjc to create the classes.
My second project depends on a class from the first project, and in particular, one of the classes I'd like to generate in my second project needs to use one of the types from the first project.
To accomplish this dependency at the schema level, I'm using a simple xsd:import
to map the namespace to a particular schema.
JAXB works just fine with this condition, except it also generates the first project's types in the second project. So after running have something like this:
Project A +-- com.foo.bar +-- TypeA Project B +-- com.foo.asdf +-- TypeB +-- com.foo.bar +-- TypeA
The second "TypeA" is undesirable, and I'd like to never generate it in the first place. How do I instruct JAXB not to generate the classes for "TypeA" that it finds as a result of the import statement?
© Stack Overflow or respective owner