javamavenwsdljaxws-maven-plugin

Generating classes from multiple wsdls using jaxws-maven-plugin


Im trying to generate classes from multiple WSDLs using jaxws-maven-plugin.
But it generates classes only from the wsdl defined in the first execution block.

I have seen this topic has been discussed in several places and i have changed my pom according to the comments. Still i cannot get it work.

         <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> 

Solution

  • I think the issue here is related to this configuration:

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

    Both executions have the same sourceDestDir. You should specify 2 different sourceDestDir, something like this:

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