jaxb
  1. jaxb
  2. JAXB-579

Add the ability to exclude namespaces from code generation

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: not determined
    • Component/s: xjc
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      579

      Description

      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.

        Activity

        Hide
        tastle added a comment -

        I believe this is the same problem faced in the OGC JAXB Schemas project also hosted here at java.net. After XJC runs, the unnecessary generated sources (normally matches the episode files fed into it) are being deleted by a Maven Ant Plugin. This is a undesirable work around.

        Now I'm running into this same case with another project.

        Show
        tastle added a comment - I believe this is the same problem faced in the OGC JAXB Schemas project also hosted here at java.net. After XJC runs, the unnecessary generated sources (normally matches the episode files fed into it) are being deleted by a Maven Ant Plugin. This is a undesirable work around. Now I'm running into this same case with another project.

          People

          • Assignee:
            jaxb-issues
            Reporter:
            kitfox
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: