1

我想使用 Maven 生成CXF。如何设置包含所有wsdl文件的 sourceroot 目录,然后告诉 maven 只选择任何 wsdl 并为找到的任何 wsdl 创建一个客户端?

到目前为止,它仅在我FooService直接指定 eg 时才有效。但我不想在 pom.xml 中手动添加 20 个服务:

<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-sources/cxf</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <!-- How can I use wildcards here??? -->
                        <wsdl>${project.basedir}/src/main/resources/wsdl/FooService.wsdl</wsdl>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>
4

1 回答 1

4

您可以将wsdlRoot选项与includes/excludes. 因此,例如,您的配置将是:

<configuration>
    <wsdlRoot>${project.basedir}/src/main/resources/wsdl</wsdlRoot>
    <includes>
        <include>*.wsdl</include>
    </includes>
</configuration>

以上摘自他们的文档,可在此处找到: http ://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html#Mavencxf-codegen-plugin%28WSDLtoJava%29- Example5:UsingwsdlRootwithincludes/excludespatterns

于 2013-10-16T09:45:36.673 回答