Multiple WSDLs Configurations With Maven JAXWS

后端 未结 2 756
别那么骄傲
别那么骄傲 2021-02-20 13:22

I need to include more than one WSDL in my Maven JAXWS configuration and I need to specify different output directories for them since some of the method names in wsdlA conflict

相关标签:
2条回答
  • 2021-02-20 13:34

    have an execution element for each wsdl and put the configuration within it. You can keep common configuration elements outside the execution element. e.g.:

    <build>
    <pluginManagement>
      <plugins>
        <plugin> 
          <groupId>org.jvnet.jax-ws-commons</groupId> 
          <artifactId>jaxws-maven-plugin</artifactId> 
          <version>2.1</version> 
          <executions>
            <execution>
              <id>wsdla</id>
              <goals> 
                <goal>wsimport</goal> 
              </goals>
              <configuration> 
                 <wsdlFile>
                   ${basedir}/src/jaxws/wsdl/wsdla.wsdl
                 </wsdlFile>
                 <sourceDestDir>target/gen/wsdla</sourceDestDir>
              </configuration> 
            </execution> 
            <execution>
              <id>wsdlb</id>
              <goals> 
                <goal>wsimport</goal> 
              </goals>
              <configuration> 
                 <wsdlFile>
                   ${basedir}/src/jaxws/wsdl/wsdlb.wsdl
                 </wsdlFile>
                 <sourceDestDir>target/gen/wsdlb</sourceDestDir>
              </configuration> 
            </execution> 
          </executions>
          <configuration> 
            <!-- Configure Output -->
            <packageName>com.mycee.project.model</packageName> 
            <!-- Configure Binding Location -->
            <bindingDirectory>
              ${basedir}/src/jaxws/binding
            </bindingDirectory>
            <!-- Make Output Verbose -->
            <verbose>true</verbose>
          </configuration> 
        </plugin>         
      </plugins>  
    
    </pluginManagement>
    

    Also, don't put generated code in /main/src/java as it won't get cleaned.

    0 讨论(0)
  • 2021-02-20 13:45

    The first thing is not to configure the configuration within the pluginManagement block. In this case it's better to define the version of the plugin only in the pluginManagement block. Furthermore to fulfill your requirement you need to have two executions like this:

       <plugin> 
        <groupId>org.jvnet.jax-ws-commons</groupId> 
        <artifactId>jaxws-maven-plugin</artifactId> 
        <executions>
            <execution> 
                <id>wsdla-exec</id>
                <goals> 
                <goal>wsimport</goal> 
                </goals>
                <configuration>
                    <packageName>com.mycee.project.model</packageName> 
                    <wsdlFiles>
                        <wsdlFile>${basedir}/src/jaxws/wsdl/wsdla.wsdl</wsdlFile>
                    </wsdlFiles>
                    <bindingDirectory>${basedir}/src/jaxws/binding</bindingDirectory>
                    <verbose>true</verbose>
                </configuration>
            </execution> 
            <execution> 
                <id>wsdlb-exec</id>
                <goals> 
                <goal>wsimport</goal> 
                </goals>
                <configuration>
                    <packageName>com.mycee.project.model</packageName> 
                    <wsdlFiles>
                        <wsdlFile>${basedir}/src/jaxws/wsdl/wsdlb.wsdl</wsdlFile>
                    </wsdlFiles>
                    <bindingDirectory>${basedir}/src/jaxws/binding</bindingDirectory>
                    <verbose>true</verbose>
                </configuration>
            </execution> 
        </executions>
    </plugin>
    
    0 讨论(0)
提交回复
热议问题