java - JAXB-2 Maven Plugin, schema inclusion and bindings -
i using jaxb-2 maven plugin generate java classes starting xsd files. configurations following. have 3 schema files without target namespace included b included c , have 2 others schemas d , e provided namespace, both of them including c. possible use bindings or different executions (with episodes) have each schema producing classes in different packages? like:
a schema (no namespace) -> com.packagea b schema (no namespace) -> com.packageb c schema (no namespace) -> com.packagec d schema (namespace x) -> com.packaged e schema (namespace x) -> com.packagee
of course without classes duplication? or best can have have 2 packages, 1 classes belonging xsds files empty namespace , 1 2 xsds files namespace x? please provide example of pom.xml file achieve that? , how can
disclaimer: i'm author of maven-jaxb2-plugin
answer plugin.
this called "separate schema compilation". can achieved using episodes, see explanation in maven-jaxb2-plugin
docs.
in short:
- create 1 maven project per logical schema. have 1 project per distinct namespace.
- if schema b uses schema a, include artifact of schema dependency of b.
maven-jaxb2-plugin
use dependencies episodes default.- in cases restover classes still generated included episodes. should not be, believe bug in xjc. in cases, add clean-up task.
- be ready face number of weird problems xjc tricky tool.
here's project compiles huge set of schemas in fashion. result 100+ artifacts dependencies closely resembling dependencies of schemas.
one problem see have schemas a, b , c having same (empty) namespace, mapping different packages. may not work jaxb (see "chameleon namespaces").
Comments
Post a Comment