【问题标题】:How to configure Multiple .wsdl in CXF Maven Plugin如何在 CXF Maven 插件中配置多个 .wsdl
【发布时间】:2020-04-27 09:30:28
【问题描述】:

在以下示例中,我可以配置 WSDL。

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.version}</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                <wsdlOptions>
                    <!-- for myService1.wsdl -->
                    <wsdlOption>
                        <wsdl>${basedir}/src/main/wsdl/myService1.wsdl</wsdl>
                    </wsdlOption>
                    <!-- for myService2.wsdl -->
                    <wsdlOption>
                        <wsdl>${basedir}/src/main/wsdl/myService2.wsdl</wsdl>
                    </wsdlOption>
                    . . .
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

但我的问题是,如果我有 100 个或更多 WSDL,那么我需要添加 100 个或更多次。

是否有任何通用方法可以在 pom.xml 文件中多次避免这种情况。

【问题讨论】:

    标签: java soap wsdl cxf


    【解决方案1】:

    &lt;wsdlRoot&gt; 元素可以被指定为使用多个 wsdls 而无需显式引用它们。

    &lt;includes&gt;可以进一步选择&lt;wsdlRoot&gt;下的wsdls

    <configuration>
        <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
        <wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
         <includes>
              <include>*Service.wsdl</include>
         </includes>                
    </configuration>
    

    https://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html#Mavencxf-codegen-plugin(WSDLtoJava)-Example5:UsingwsdlRootwithincludes/excludespatterns

    【讨论】:

      猜你喜欢
      • 2013-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-14
      • 1970-01-01
      • 1970-01-01
      • 2011-06-15
      • 2014-08-06
      相关资源
      最近更新 更多