问题描述
我是这方面的新手,但是我试图将Windows应用程序移植到Linux上,并遇到xmlbeans问题.我们有少数xsd文件生成类文件.在Windows上,我将得到Driver.class(2k)
和Driver2.class(10k)
.在Linux上,通过Maven进行的同一构建将得到Driver.class(10k)
和Driver2.class(2k)
.因此,似乎存在一个排序问题,导致使用这些类的Linux构建应用程序无法编译.使用Driver/Driver的Java代码会出现类型不兼容的错误:
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:
:xx.xmlbinding.Driver2
必需:xx.xmlbinding.Driver
不同的xsd文件在文件中具有相同的complexType:
Different xsd files have the same complexType in the file:
<xsd:complexType name="Driver">
任何有关如何解决此问题的见解?谢谢!
Any insight on how I can resolve this? Thanks!
推荐答案
为什么会有两种具有相同名称空间和名称的驱动程序类型?
Why do you have two Driver types with the same namespace and name?
如果驱动程序"类型是相同的类型,并且在两个模式中重复,则将驱动程序"移到单独的模式并使用<import>
.如果这两种模式和驱动程序类型确实不同,则将其移至其他名称空间或给其命名.如果无法在单独的步骤中编译这两个模式,则需要将它们加载到单独的类加载器中,以避免在运行时发生冲突.
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.
这篇关于XMLBeans-如何控制生成的类文件? Windows vs Linux问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!