JAXB binding multiple files with same namespace to same package

后端 未结 1 1714
野趣味
野趣味 2021-01-28 06:04

I\'m having a schema hierarchy like this:

common
   |---legacy
   |      |---legacy.xsd xmlns=\"http://common/legacy\"
   |      |---other.xsd  xmlns=\"http://co         


        
相关标签:
1条回答
  • 2021-01-28 06:30

    Disclaimer: I'm the author of maven-jaxb2-plugin.

    XJC derives packages from namespaces, so you (normally) can't generate several packages for one namespace. There are a few tricks with jaxb:class/@ref but you don't want those as this may lead to all kinds of collisions.

    So my suggestion would be to define multiple executions, one per distinct schema in the same namespace. You could use generatePackage although I generally advise to define package mappings in bindings instead.

    When doing multiple executions, make sure you use distinct generateDirectory per execution.

    By the way, why are you not comfortable with multiple bindings?

    0 讨论(0)
提交回复
热议问题