简体   繁体   中英

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

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

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM