问题
I'm a newbie at this stuff, but I'm trying to port a Windows app over to Linux and encountered issues with the xmlbeans. We have a handful of xsd files generating class files. On Windows, I'll get Driver.class(2k)
and Driver2.class(10k)
. On Linux, the same build through Maven I'll get Driver.class(10k)
and Driver2.class(2k)
. So there appears to be an ordering issue which causes the Linux build application using these classes to not compile. The java code using Driver/Driver errors out with incompatible types:
found : xx.xmlbinding.Driver2
required: xx.xmlbinding.Driver
Different xsd files have the same complexType in the file:
<xsd:complexType name="Driver">
Any insight on how I can resolve this? Thanks!
回答1:
Why do you have two Driver types with the same namespace and name?
If the 'Driver' type is the same type and is duplicated in the two schemas, move Driver to a separate schema and use <import>
. If the two schemas and Driver types are indeed different, move one to a different namespace or give it a different name. If that isn't possible compile the two schemas in separate steps -- you'll then need to load them in separate classloaders to avoid collisions at runtime.
来源:https://stackoverflow.com/questions/10908604/xmlbeans-how-to-control-generated-class-files-windows-vs-linux-issues