基于
documentation it can be done like the following:
<plugin>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<version>1.2.4.5</version>
<configuration>
<schemaLocation>src/main/conf</schemaLocation>
<includeSchemas>
<includeSchema>myschema.xsd</includeSchema>
</includeSchemas>
<options>
<package>my.package</package>
</options>
</configuration>
<executions>
<execution>
<goals>
<goal>schema-codegen</goal>
</goals>
</execution>
</executions>
</plugin>
但是,您应该小心使用packagename,而不是来自xsd命名空间的默认名称,因为如果您有多个命名空间,则可能会在生成的源中发生冲突。
您可以定义多个执行,使不同的模式具有不同的包名称。
<plugin>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<version>1.2.4.5</version>
<executions>
<execution>
<id>schemata-a</id>
<goals>
<goal>schema-codegen</goal>
</goals>
<configuration>
<schemaLocation>src/main/conf-a</schemaLocation>
<includeSchemas>
<includeSchema>myschema.xsd</includeSchema>
</includeSchemas>
<options>
<package>my.package.a</package>
</options>
</configuration>
</execution>
<execution>
<id>schemata-b</id>
<goals>
<goal>schema-codegen</goal>
</goals>
<configuration>
<schemaLocation>src/main/conf-b</schemaLocation>
<includeSchemas>
<includeSchema>xyz.xsd</includeSchema>
</includeSchemas>
<options>
<package>my.package.b</package>
</options>
</configuration>
</execution>
</executions>
</plugin>
如果您可以更改xsd文件中的名称空间,则会使生活更轻松。