3
votes

I don't seem to be able to work out how to get control the file name of the XSD file created by maven-jaxb-schemagen-plugin. The documentation is a bit sparse.

        <groupId>com.sun.tools.jxc.maven2</groupId>
        <artifactId>maven-jaxb-schemagen-plugin</artifactId>
        <version>1.2</version>
        <configuration>
           <project>${project}</project>
           <destdir>${project.build.directory}/generated-resources/schemas</destdir>
           <srcdir>${project.build.sourceDirectory}/my/jaxb/bean/package</srcdir>
           <verbose>true</verbose>
        </configuration>

It always seems to create a file called schema1.xsd

1

1 Answers

4
votes

You need to add schema elements which describe which file should contain the elements of each namespace you have:

<configuration>
    [...]
    <schemas>
       <schema>
          <namespace>http://www.example.invalid/2001/05/27/wibble</namespace>
          <file>wibble.xsd</file>
       </schema>
    </schemas>
<configuration>

Assuming you have set the namespace of you components

@XmlRootElement(name = "wobble", namespace="http://www.example.invalid/2001/05/27/wibble")