Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
sbt plugin reads xsds in non-deterministic order across OSes causing problems where there are namespace conflicts #207
If XSDs are not given their own package each, Scalaxb resolves namespace conflicts by arbitrarily assigning unique type names to generated code. This caused a problem for us under the sbt plugin when different O/S ran the code, because we found that Linux assigned different unique names to MacOSX.
This turned out to be because the SBT plugin was reading files in a different order on Linux than it was on MacOSX and that therefore it was choosing unique names in a different order.
This should be fixed by making sure that the SBT plugin (and other ways of running scalaxb) read XSD files in the same order regardless of the operating system.
This might seem like an edge-case bug of little stature, but it is very painful to encounter as it is non-trivial to diagnose the underlying problem and to apply the configuration so excellently documented in http://scalaxb.org/multiple-schema-files.
Same problem here using the same linux on different PCs.
A WSDL file I parse defines an enum type and scalaxb creates a sealed trait and case objects for it.
Scalaxb then numbers the created case objects:
On a different PC, I got
I'm not able to check the received values with
because the numbering is different on different platforms.
For what it's worth, the maven plugin simply applies Collections.sort to the list of files (see #110) before processing.
I'm not sure whether this is the right thing to do, particularly when there are sub-directories under src/main/xsd, but that's how it is right now.