0

I have XSD schema importing another schema, the import looks something like this:

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

It only works like this, with an absolute path. However, both schemas are in the same folder and I need to make it work with simple relative path, like following:

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

This path however throws the following exception during compilation:

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>.

The most confusing thing about my problem is that the entire project is cloned from git and it works just fine with the simple relative path (exactly as shown) for anyone else except me. I haven't changed anything at all in the project, I have reinstalled Java and Maven (just to be sure or maybe out of pure desperation), I have the same maven settings as my colleagues.

I'll be glad for any ideas or suggestions, thanks.

J H
  • 1
  • 1
  • If you're using `maven-jaxb2-plugin`, run it with `mvn clean instal -e -X` and post the Maven log. – lexicore Aug 28 '19 at 06:15
  • @lexicore Maybe I'm missing something since I'm not used to posting here, but even the stack trace exceeds the post/comment char limit. How or where should I post it? – J H Aug 29 '19 at 18:08
  • Pastebin, for instance. – lexicore Aug 29 '19 at 18:15
  • @lexicore ok here is the stack trace https://pastebin.com/pbv68XWx – J H Aug 29 '19 at 18:42
  • No idea, sorry. Maybe try with `maven-jaxb2-plugin`? (You use `jaxb2-maven-plugin` at the moment.) – lexicore Aug 29 '19 at 18:46
  • @lexicore Maybe that would work, but I don't think I can change that much, since it's a huge project with so many people working on it. It would likely break more things that it would fix. But I guess I'll just add "file://" to the schema location, that should work for everyone (including me). It's more about just being curious about why the hell it works for everyone else except me. Thank you for your time tho. – J H Aug 29 '19 at 19:02

0 Answers0