Maven jaxb generates a plugin to read xsd files from multiple directories

If I have an xsd file in the following directories

src/main/resources/xsd src/main/resources/schema/common src/main/resources/schema/soap 

How can I instruct the maven jaxb plugin to create jaxb classes using all the schema files in the above directory? I can get it to generate class files if I specify one of the folders, but I canโ€™t get it, I donโ€™t know how to include all three folders.

This is how I create files for one folder:

 <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemaDirectory>src/main/resources/xsd</schemaDirectory> </configuration> </plugin> 

I tried adding a few elements to the element, but it just ignores them all if I do this.

thanks

+4
source share
2 answers

u can try this configuration:

 <configuration> <schemaDirectory>src/main/resources</schemaDirectory> <schemaIncludes> <include>xsd/*.xsd</include> <include>schema/*/*.xsd</include> </schemaIncludes> </configuration> 

source: http://confluence.highsource.org/display/MJIIP/User+Guide

+8
source

The plugin describes how to embed schema files in src / main / resources , and not in subfolders. I would recommend using the default settings for the plugin in the sense of a configuration agreement. In addition, it is important that the schemas include the correct files, including the correct folders.

In such situations, it is best to have a separate module that contains only schemas and possibly some supporting classes.

+2
source

All Articles