我有以下项目结构之间的模糊:删除hyperjaxb生成的类和Apache CXF产生clases
服务父
| __service-模式
| __service数据库
| __service -contract
| __service-implementation
我正在使用hyperjaxb3,因为我最终需要通过Web服务传递的对象是最终将存储在数据库中的对象(不需要转换)。
在模块服务架构我已经定义了我将在我的web服务中使用的XSD架构。 服务数据库将通过hyperjaxb3使用生成JPA-JAXB对象。 服务合同将通过使用cxf-codegen-plugin maven插件生成java服务接口。 服务实现将是最终的Web服务实现。我认为这个想法是可以的。然而,当我使用hyperjaxb3和cxf-codegen-plugin时,问题会增加,因为我需要JPA类(我使用hyperjaxb3生成的类)来扩展BaseCustomClass。问题是,当我创建我的测试,比如web服务方法persitCustom(CustomType),XML被反序列化为CustomType由cxf-codegen-plugin生成(这是我用来生成的工具服务接口)。现在,这个类并不完全是由hyperjaxb3生成的(尽管它在编译时不是问题,因为两个类“几乎”相同,属性相同,包相同等等)生成的CustomType问题是我如何强制我的服务实现使用hyperjaxb3生成的类而不是cxf-codegen-plugin生成的类。
这些都是我使用
<plugin>
<groupId>org.jvnet.hyperjaxb3</groupId>
<artifactId>maven-hyperjaxb3-plugin</artifactId>
<version>0.6.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<extension>true</extension>
<args>
<arg>-Xinheritance</arg>
</args>
</configuration>
</plugin>
这个版本是CXF-CODEGEN-插件
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.9</version>
<executions>
<execution>
<id>process-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>
${project.build.directory}/src/main/resources/SharedModel/sampleWeb/service.wsdl
</wsdl>
<wsdlLocation>classpath*:sampleWeb/service.wsdl</wsdlLocation>
<bindingFiles/>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
什么行家hyperjaxb3的版本,CXF-CODEGEN-插件,您使用在哪里,请加入这些详细 – Ashoka
我加入了版本 –
简短的回答:使用HJ3生成JAR作为插曲。我稍后会发布完整答案。 – lexicore