Jaxb2在相对路径上找不到xsd模式

时间:2019-08-26 18:36:34

标签: java maven jaxb maven-jaxb2-plugin jaxb2-maven-plugin

我有XSD架构正在导入另一个架构,该导入看起来像这样:

 <xsd:import schemaLocation="file:///C:/Work/Project/src/main/resources/xsd/schema2.xsd" namespace="http://www.namespace.com/schema2/v2" />

它只能像这样使用绝对路径。但是,这两种模式都在同一个文件夹中,我需要使其使用简单的相对路径来工作,如下所示:

<xsd:import schemaLocation="schema2.xsd" namespace="http://www.namespace.com/schema2/v2" />

但是,此路径在编译过程中会引发以下异常:

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'schema2.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

关于我的问题,最令人困惑的事情是,整个项目都是从git克隆的,并且对于除我以外的任何人,它都可以通过简单的相对路径(完全如图所示)正常工作。我没有在项目中进行任何更改,我重新安装了Java和Maven(只是为了确保甚至完全出于绝望),我的maven设置与同事相同。

谢谢您的任何想法或建议。

0 个答案:

没有答案