Hi.
> I currently have two projects, each producing their own .jar file. In
> project one, I have two schema files, A.xsd and B.xsd. Each of these are
> described in an episode file. The episode file is generated by the M2
> plugin so it is nothing special. In project two I have a schema file A1.xsd
> that imports A.xsd but not B.xsd. Project2 will not compile correctly
> because I am not also importing B.xsd. I get the following error.
>
> /META-INF/sun-jaxb.episode[11,86]: com.sun.istack.SAXParseException2: SCD
> "x-schema::tns" didnt match any schema component
>
> Is it possible to consume only one of the XSD files from project1 and not
> the other? If so, is this something that I need to change in project1's
> episode file or is it something that needs be changed when generating
> project2? If not, why is this not allowed?
>
> I know the workaround is to place each of the XSDs in their own project with
> their own episode file but this causes a bit of bloat in the number of
> projects to maintain.
You know, it's not something that isn't allowed explicitly, it's just
something which grew historically. There was no episodes/separate
compilation few versions ago, so the solution is quite fresh and may
not consider all the possible use cases.
Concerning the problem you're describing, I'd say you have two options.
1. Import both A.xsd and B.xsd. There should be no classes generated
for B.xsd (well, almost, there are some issues with enums and object
factory), so why not. If unnecessary classes are generated, just
delete them with antrun plugin.
2. Separate A.xsd and B.xsd into two different projects. Yes, this
does increase the number of modules, but I don't think it's that
critical especially when you have Maven dependency management.
Further options could be writing your own or processing generated
episode files. There's quite a number of thing that can be done but
I'd stay with one of the two options above.
Bye.
/lexi