【问题标题】:How to specify frontend for wsdl2java in a pom.xml?如何在 pom.xml 中为 wsdl2java 指定前端?
【发布时间】:2012-12-15 18:51:15
【问题描述】:

我发现 this great tip-fe jaxws21 添加到 wsdl2java 命令以使其生成符合 jaxws 2.1 的代码而不是 2.2,但是 Maven 的 pom.xml 在这样放置时似乎不喜欢这个添加:

            <goals>
                <goal>wsdl2java -fe jaxws21</goal>
            </goals>

为 pom.xml 中使用的 wsdl2java 指定前端的正确方法是什么?

【问题讨论】:

    标签: java maven cxf pom.xml wsdl2java


    【解决方案1】:

    为了补充@fishbone 和@tafit3 的答案,另请参阅Could not find jaxws21 frontend within classpath,因为看起来frontend 是在次要的cxf 版本中添加的。

    我尝试了他们的答案,但只有在将 cxf-codegen-plugin 升级到 2.3.11 后才能正常工作

    【讨论】:

      【解决方案2】:

      您可以在&lt;wsdlOption&gt;&lt;defaultOption&gt; 中使用&lt;frontEnd&gt;。如果您包含多个 WSDL 并指定 &lt;wsdlRoot&gt;,则后者很有帮助:

      <executions>
          <execution>
              <configuration>
                  <defaultOptions>
                      <frontEnd>jaxws21</frontEnd>
                  </defaultOptions>
                  <wsdlRoot>${basedir}/src/main/wsdl</wsdlRoot>
                  <includes>
                      <include>*.wsdl</include>
                  </includes>
              </configuration>
              <goals>
                  <goal>wsdl2java</goal>
              </goals>
          </execution>
      </executions>
      

      【讨论】:

        【解决方案3】:

        如果您使用的是 cxf-codegen-plugin,您可以在 extraargs 元素中添加参数:

        <executions>
            <execution>
                <configuration>
                    <wsdlOptions>
                        <wsdlOption>
                            <wsdl>...</wsdl>
                            <extraargs>
                                <extraarg>-fe</extraarg>
                                <extraarg>jaxws21</extraarg>
                            </extraargs>
                        </wsdlOption>
                    </wsdlOptions>
                </configuration>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
            </execution>
        </executions>
        

        来源:http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html

        【讨论】:

        • 你也可以做 jaxws21
        • 我使用了 ${basedir}/src/main/wsdl 而不是 。现在我该如何提供 呢?
        猜你喜欢
        • 2019-04-26
        • 1970-01-01
        • 2016-09-03
        • 2013-11-20
        • 1970-01-01
        • 2017-06-13
        • 2019-06-25
        • 2011-09-01
        • 2013-05-19
        相关资源
        最近更新 更多