Frage

I'm trying to generate java classes using JAXB from a schema in my class path. For CXF I generated java classes from a wsdl in my classpath like so:

<wsdlOptions>
    <wsdlOption>
        <wsdl>classpath:wsdl/MetsInterfaceService.wsdl</wsdl>
    </wsdlOption>
</wsdlOptions>

I was hoping something similar existed with JAXB. I did try using a catalog but this seems to be more in line when a schema (stored in the same maven module) imports another schema in the classpath.

Any help would be appreciated! -Sal

War es hilfreich?

Lösung

The CXF XJC Maven Plugin appears to support classpath:.

The XsdOption object is used to pass specific options and configuration for each XSD file that is to be processed.

The example on the site shows classpath: used in several ways in <xsdOption> paths for <xsd>, <bindingFile>, and <catalog> paths:

<configuration>
    <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
    <xsdOptions>
        <xsdOption>
            <xsd>classpath:/schemas/wsdl/http.xsd</xsd>
            <bindingFile>classpath:/schemas/wsdl/http.xjb</bindingFile>
            <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
        </xsdOption>
        <xsdOption>
            <xsd>classpath:/schemas/wsdl/ws-addr.xsd</xsd>
            <packagename>org.apache.cxf.ws.addressing</packagename>
        </xsdOption>
        <xsdOption>
            <xsd>classpath:/schemas/wsdl/addressing.xsd</xsd>
            <bindingFile>classpath:/schemas/wsdl/addressing.xjb</bindingFile>
        </xsdOption>
        <xsdOption>
            <xsd>classpath:/schemas/configuration/security.xsd</xsd>
            <bindingFile>classpath:/schemas/configuration/security.xjb</bindingFile>
            <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
            <extensionArgs>
                <extensionArg>-Xdv</extensionArg>
            </extensionArgs>
        </xsdOption>
        <xsdOption>
            <xsd>classpath:/schemas/wsdl/ws-addr-wsdl.xsd</xsd>
            <bindingFile>classpath:/schemas/wsdl/ws-addr-wsdl.xjb</bindingFile>
            <extension>true</extension>
        </xsdOption>
        <xsdOption>
            <xsd>classpath:/schemas/wsdl/addressing200403.xsd</xsd>
            <bindingFile>classpath:/schemas/wsdl/addressing200403.xjb</bindingFile>
        </xsdOption>
    </xsdOptions>
</configuration>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top