Java 具有相对路径的Jaxb2目录文件

Java 具有相对路径的Jaxb2目录文件,java,jaxb,xsd,jaxb2,catalog,Java,Jaxb,Xsd,Jaxb2,Catalog,我试图从相当多的XSD生成一些Java代码。它们中的大多数都工作得很好,但是我在使用一个特定的XSD导入另一个具有相对路径的XSD时遇到了问题。例如: <?xml version="1.0" encoding="UTF-8"?> <schema xmlns:xmpl="http://example.com/this/is/namespace" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://exa

我试图从相当多的XSD生成一些Java代码。它们中的大多数都工作得很好,但是我在使用一个特定的XSD导入另一个具有相对路径的XSD时遇到了问题。例如:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xmpl="http://example.com/this/is/namespace" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/this/is/namespace">
    <include schemaLocation="../../0301/required.xsd" />
    <some> ... xml ... </some>
</schema>

但它就是不起作用。有人有什么想法吗?

不幸的是,maven-jaxb2-plugin项目在这个问题上有一个公开的问题:

<!DOCTYPE catalog
    PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" 
    "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">

    <public publicId="required.xsd" uri="maven:com.geodan.imgeo:stuf!stuf0301!stuf/stuf0301.xsd" />

    <public publicId="../../0301/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

    <public publicId="http://example.com/this/is/namespace/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

    <public publicId="http://example.com/this/is/namespace/../../required.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

    <public publicId="http://example.com/stuf0301.xsd" uri="maven:com.project.example!module!folder/required.xsd" />

</catalog>
--
  Standard Catalog test file for Imgeo
--

PUBLIC "http://example.com/this/is/namespace/required.xsd" "module/src/main/resources/folder/required.xsd"

PUBLIC "../../0301/required.xsd" "module/src/main/resources/folder/required.xsd"

PUBLIC "0301/required.xsd" "module/src/main/resources/folder/required.xsd"