简体   繁体   中英

Jaxb2 : create separate directorie per namespace

im using maven-jaxb2-plugin to generate from a 1.0xsd file:

<plugin>    
  <groupId>org.jvnet.jaxb2.maven2</groupId>   
  <artifactId>maven-jaxb2-plugin</artifactId>    
  <executions>
    <execution>
     <id>generate-modelesV1.0</id>
     <goals>
       <goal>generate</goal>
     </goals>
     <configuration>       
       <schemaDirectory>src/main/resources/schemas/modeles</schemaDirectory>
       <generatePackage>fr.recouv.scribe.core.jaxb.pojo</generatePackage>
       <schemaIncludes>
         <include>modeles-v1.0.xsd</include>
       </schemaIncludes>
      </configuration>
    </execution>
   </executions>
 </plugin>

Unfortunately ALL classes are in the same directory. I want a directory per namespace if possible. I've already looked in the online documentation without success.

I'm asking that because in a future we will have a new version of the xsd (1.1) & we want to conserve retrocompatibility. Each element with the same name but with in different namespace will exist in their own directory.

according to the documentation:

generatePackage - The generated classes will all be placed under this Java package (XJC's -p option), unless otherwise specified in the schemas. If left unspecified, the package will be derived from the schemas only.

So have a look at the jaxb2 documentation how to use this option

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