使用Maven JAXWS的多个WSDL配置 [英] Multiple WSDLs Configurations With Maven JAXWS

查看:78
本文介绍了使用Maven JAXWS的多个WSDL配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的Maven JAXWS配置中包括多个WSDL,并且我需要为它们指定不同的输出目录,因为wsdlA中的某些方法名称与wsdlB中的方法名称冲突.我正在使用org.jvnet.jax-ws-commons,我需要绑定仅适用于wsdlA,而不适用于wsdlB.

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 with method names in wsdlB. I'm using org.jvnet.jax-ws-commons and I need bindings to apply only to wsdlA, not wsdlB.

这是我目前所拥有的:

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

已更新:

<build>
    <pluginManagement>
      <plugins>
          <!-- WSDL GENERATOR PLUGIN -->
          <!-- mvn jaxws:wsimport    -->
          <plugin> 
              <groupId>org.jvnet.jax-ws-commons</groupId> 
              <artifactId>jaxws-maven-plugin</artifactId> 
              <version>2.3</version> 
              <executions>
                  <!-- WSDL A -->
                  <execution>
                      <id>WSDLA</id>
                      <phase>generate-sources</phase>
                      <goals> 
                          <goal>wsimport</goal> 
                      </goals>
                      <configuration>
                          <packageName>com.mycee.project.model.wsdla</packageName>                                                                    <staleFile>${project.build.directory}/jaxws/stale/wsdl.a.done</staleFile>
                          <wsdlFiles>
                              <wsdlFile>${basedir}/src/jaxws/wsdl/wsdla.wsdl</wsdlFile>
                          </wsdlFiles>
                          <bindingDirectory>${basedir}/src/jaxws/binding</bindingDirectory>
                      </configuration>                          
                  </execution>
                  <!-- WSDL B -->
                  <execution>
                      <id>WSDLB</id>
                      <phase>generate-sources</phase>
                      <goals> 
                          <goal>wsimport</goal> 
                      </goals>
                      <configuration>        
                          <packageName>com.mycee.project.model.wsdlb</packageName>
                          <staleFile>${project.build.directory}/jaxws/stale/wsdl.b.done</staleFile>
                          <wsdlFiles>
                              <wsdlFile>${basedir}/src/jaxws/wsdl/wsdlb.wsdl</wsdlFile>
                          </wsdlFiles>
                      </configuration>
                  </execution>
              </executions>
              <!-- Common Config -->  
              <configuration>
                  <verbose>true</verbose>
                  <wsdlDirectory>
                      ${basedir}/src/jaxws/wsdl
                  </wsdlDirectory>
              </configuration>
          </plugin> 
      </plugins>  
    </pluginManagement>
  </build>

运行mvn clean jaxws:wsimport时,收到以下通知,但未生成任何Java代码:

When running mvn clean jaxws:wsimport, I get the following notification with no java code being generated:

[INFO] --- jaxws-maven-plugin:2.2:wsimport(default-cli)@ [INFO]找不到要处理的WSDL,请指定 至少有以下参数之一:wsdlFiles,wsdlDirectory或wsdlUrls.

[INFO] --- jaxws-maven-plugin:2.2:wsimport (default-cli) @ [INFO] No WSDLs are found to process, Specify atleast one of the following parameters: wsdlFiles, wsdlDirectory or wsdlUrls.

推荐答案

第一件事不是在pluginManagement块中配置配置.在这种情况下,最好仅在pluginManagement块中定义插件的版本.此外,要满足您的要求,您需要执行两次这样的执行:

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>

这篇关于使用Maven JAXWS的多个WSDL配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆