The name of the control schema file created by jaxb schemagen maven plugin (maven-jaxb-schemagen-plugin)

It seems I can’t decide how to get the file name control 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 seems like a file called schema1.xsd is being created

+3
source share
1 answer

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

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

Assuming you created your component namespace

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

All Articles