Question

I'm building (multiple) complex webservice with base XSD types from all kinds of standards (GML, SWE, XLINK, etc). Now, I would like to break up the compilation into more steps, preferrably one for each of the standards I'm using.

Advantages:

1) I can add create tooling libraries that I can re-use in all of my webservices on each of the standards.

2) I can make use of the power of JAXB2 basics plugin, which seems to work very nicely with the maven-jaxb2-plugin (org.jvnet.jaxb2.maven2) and create for instance interface bindings. This in contrast with the jaxws-maven-plugin plugin.

The final step would be using the org.jvnet.jax-ws-commons:maven-jaxb2-plugin to create the actual web service that I can implement in an EJB (or call as a client).

Now, the org.jvnet.jaxb2.maven2:maven-jaxb2-plugin plugin allows me to refer to episodes by means of their maven coordinate, as part of its like this:

<episodes>
    <episode>
        <groupId>org.example</groupId>
        <artifactId>jaxb2-basics-test-episodes-a</artifactId>
    </episode>
</episodes>

How can I do this by means of the org.jvnet.jax-ws-commons:maven-jaxb2-plugin? I've searched a lot, and experimented like this:

<plugin>
    <groupId>org.jvnet.jax-ws-commons</groupId>
    <artifactId>>maven-jaxb2-plugin</artifactId>
    <version>2.1</version>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <wsdlDirectory>src/main/resources/</wsdlDirectory>
        <wsdlFiles>
            <wsdlFile>example.wsdl</wsdlFile>
        </wsdlFiles>                    
        <xjcArgs>
            <xjcArg>-b</xjcArg>
            <xjcArg>../cpt-xsd/target/generated-sources/xjc/META-INF/sun-jaxb.episode</xjcArg>
        </xjcArgs>                  
        <verbose>true</verbose>
    </configuration>
</plugin>

Which takes the episode file from the target dir of the (compiled) JAXB dependend project. This sometimes even fails in the maven build (why I did not figure out yet).

I've tried to use catalog files to make a mapping but (I think I saw somewhere a catalog mapping that took maven coordinates as destination), but haven't succeeded yet.

Was it helpful?

Solution

Are you aware of the OGC Schemas and Tools Project? (Disclaimer: I'm the author.)

Now, to your question. My guess would be that org.jvnet.jax-ws-commons:maven-jaxb2-plugin does not support the "Maven coordinates" as you call them. This was a feature I've specifically implemented for my org.jvnet.jaxb2.maven2:maven-jaxb2-plugin (disclaimer: I'm the author).

From the other hand, episode file is nothing but a JAXB binding file. So you can simply extract this file from the JAR artifact (for instance using the maven-dependency-plugin) and then include it more or less like you do it already. Just don't point to directories in other modules, this is not reliable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top