I have different service schema files(more than 5), from which I wanted to generate a jar file using xmlbeans.
I was using xmlbean plugin as follows
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>${xmlbeans.version}</version>
<executions>
<execution>
<goals>
<goal>xmlbeans</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<inherited>true</inherited>
<configuration>
<download>true</download>
<javaSource>${java.version}</javaSource>
<schemaDirectory>src/main/xsd</schemaDirectory>
<xmlConfigs>
<xmlConfig implementation="java.io.File">src/main/xsdconfig/xsdconfig.xml</xmlConfig>
</xmlConfigs>
</configuration>
</plugin>
</plugins>
I want to have different package name for different service schema. How to specify that and where to provide the schema path and xsdConfig file to apply the package details.
Please advice.
You need to define a file ending in
.xsdconfig(e.g.myConfig.xsdconfig) to map the targetNamespace in each of your schema files to a Java package name. Put this.xsdconfigfile in the same directory as the corresponding.xsdfile that you are compiling. Suppose for example you have the following.xsdfile:Then you would define the following
myConfig.xsdconfigfiles as follows:It is also possible to control the names of the Java classes generated from each of your schema files.
You can read more about this in the official XMLBeans documentation.