Java maven cxf codegen插件使用Jaxb绑定为所有生成的类添加继承
我正在使用apachecxf的cxfcodegen插件将wsdl转换为java对象。我指定了一个绑定文件来添加额外的jaxb处理。我希望所有这些文件都从接口继承(或扩展抽象类) 我的问题是,虽然我可以使用Java maven cxf codegen插件使用Jaxb绑定为所有生成的类添加继承,java,inheritance,jaxb,jax-ws,cxf,Java,Inheritance,Jaxb,Jax Ws,Cxf,我正在使用apachecxf的cxfcodegen插件将wsdl转换为java对象。我指定了一个绑定文件来添加额外的jaxb处理。我希望所有这些文件都从接口继承(或扩展抽象类) 我的问题是,虽然我可以使用 <jaxb:bindings node="xsd:complexType[@name='sampleObj'] "> <inheritance:implements>example.Dao</inheritance:implements>
<jaxb:bindings node="xsd:complexType[@name='sampleObj'] ">
<inheritance:implements>example.Dao</inheritance:implements>
</jaxb:bindings>
例如,道
这将使sampleObj实现example.Dao。
我不知道如何处理我所有的复杂类型(生成的类)。无需对每个类重复上述绑定(>100)
我试过了
<jaxb:bindings multiple="true" node="//xsd:compexType[@name='*'] ">
但它不起作用
这是我的maven插件,如果有帮助的话:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-resources</id>
<phase>process-resources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${wsdl_location}</wsdl>
<wsdlLocation>classpath:wsdl.wsdl</wsdlLocation>
<!--<wsdlLocation>classpath:wsdl.wsdl</wsdlLocation>-->
<extraargs>
<extraarg>-autoNameResolution</extraarg>
<extraarg>-xjc-Xfluent-api</extraarg>
<extraarg>-xjc-Xbg</extraarg>
<extraarg>-verbose</extraarg>
<extraargs>-validate</extraargs>
<extraargs>-mark-generated</extraargs>
<extraargs>-xjc-Xinheritance</extraargs>
<extraarg>-p</extraarg>
<extraarg>com.example</extraarg>
</extraargs>
<bindingFiles>
<bindingFile>${project.build.directory}\classes\jax-ws_binding.xjb</bindingFile>
</bindingFiles>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-fluent-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-runtime</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-boolean</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
org.apache.cxf
cxf-codegen插件
${cxf.version}
产生资源
过程资源
${project.build.directory}/已生成/
${wsdl_location}
类路径:wsdl.wsdl
-自动命名解析
-xjc Xfluent api
-xjc Xbg
-冗长的
-证实
-标记生成
-xjc新遗传
-p
com.example
${project.build.directory}\classes\jax-ws\u binding.xjb
wsdl2java
org.jvnet.jaxb2_commons
jaxb2 fluent api
3
org.jvnet.jaxb2_commons
jaxb2基础知识
0.6.5
org.jvnet.jaxb2_commons
jaxb2基础注释
0.6.5
org.jvnet.jaxb2_commons
jaxb2基础运行时
0.6.5
org.apache.cxf.xjc插件
cxf xjc布尔型
2.7.0
org.apache.cxf
cxfapi
${cxf.version}
试试这个
<jaxb:bindings node="xsd:complexType">
Ahh,终于找到了:将
multiple=“true”
添加到绑定
标记中:
hu.eir.ifx.IfxExchange
我希望实现与您完全相同的目标。。你找到答案了吗?