使用jaxws-maven-plugin从多个wsdls生成类

时间:2017-10-11 09:07:25

标签: java maven wsdl jaxws-maven-plugin

我试图使用jaxws-maven-plugin从多个wsdls生成类。我已经看到这个话题在几个地方已经讨论过,我根据评论改变了我的pom。我仍然无法让它发挥作用。它仅从第一个执行块中定义的wsdl生成类。

<plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>session-wsdl</id>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlFiles>
                                <wsdlFile>src/main/resources/wsdl/SESSION.wsdl</wsdlFile>
                            </wsdlFiles>
                            <bindingDirectory>${project.basedir}</bindingDirectory>
                            <keep>true</keep>
                            <sourceDestDir>${genSrc.directory}</sourceDestDir>
                        </configuration>
                    </execution>
                    <execution>
                        <id>api-wsdl</id>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlFiles>
                                <wsdlFile>src/main/resources/wsdl/STAGE.wsdl</wsdlFile>
                            </wsdlFiles>
                            <bindingDirectory>${project.basedir}</bindingDirectory>
                            <keep>true</keep>
                            <sourceDestDir>${genSrc.directory}</sourceDestDir>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                    <wsdlDirectory>
                        ${basedir}/
                    </wsdlDirectory>
                </configuration>
            </plugin> 

1 个答案:

答案 0 :(得分:1)

我认为这里的问题与此配置有关:

<sourceDestDir>${genSrc.directory}</sourceDestDir>

两个执行都具有相同的sourceDestDir。您应该指定2个不同的sourceDestDir,如下所示:

<!-- sourceDestDir for the first execution -->
<sourceDestDir>${genSrc.directory}/session</sourceDestDir>

<!-- sourceDestDir for the second execution -->
<sourceDestDir>${genSrc.directory}/stage</sourceDestDir>