Search code examples
jaxbjaxb2xjc

XJC re-use classes across ant tasks


I am exploring options to use same classes across two different ant tasks. In the first task, I am already building the jar & deleting the generated classes. Xjc does not allow passing a jar as a parameter for reference. One option that I currently did is regenerate the episode file only from the xsd and construct another jar. Is there any better approach?


Solution

  • Please see this post:

    http://blog.bdoughan.com/2011/12/reusing-generated-jaxb-classes.html

    The right way to do this:

    • Use -episode to generate the episode file on your first schema
    • Use the generated episode JAR during the second compilation
    • (In some cases) remove the leftovers

    So episodes are definitely the way to go. I don't quite understand what do you mean by "Xjc do not allow to pass jar as parameter for reference".