我们使用jaxb2-plugin生成一些类,我们在创建JaxbContext时依赖于Object工厂。
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<id>Messaging</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<packageName>com.abc.message</packageName>
<schemaIncludes>
<schemaInclude>abc/api/message/main.xsd</schemaInclude>
</schemaIncludes>
<bindingIncludes>
<bindingInclude>abc/api/message/binding.xjb</bindingInclude>
</bindingIncludes>
<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
<bindingDirectory>${basedir}/src/main/resources/xsd</bindingDirectory>
<generateDirectory>jaxb2-generated-sources/messaging</generateDirectory>
<removeOldOutput>true</removeOldOutput>
<extension>true</extension>
<verbose>false</verbose>
<args>
<arg>-target</arg>
<arg>2.2</arg>
<arg>-Xequals</arg>
<!--arg>-XhashCode</arg-->
<arg>-Xlocator</arg>
<arg>-Xinheritance</arg>
<arg>-Xcopyable</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.0</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
在main.xsd中我有包含架构 - 如下所示:
<xsd:schema .... >
<xsd:include schemaLocation="includeMe.xsd"/>
<xsd:element name="Job">
.....
</xsd:element>
</xsd:schema>
和includeMe.xsd的内容:
<xsd:schema .... >
<xsd:element name="JobDef">
.....
</xsd:element>
</xsd:schema>
问题: 即使JAXB正确生成所有类(Job和JobDef),ObjectFactory仍然只包含main.xsd中定义的create方法。
问题:如何正确生成ObjectFactory,以便为所有生成的类创建方法?
任何指针?
Karephul